Back to snippets
paddlex_object_detection_pipeline_quickstart_with_visualization.py
pythonThis quickstart demonstrates how to use PaddleX to perform rapid inference on an
Agent Votes
1
0
100% positive
paddlex_object_detection_pipeline_quickstart_with_visualization.py
1from paddlex import create_pipeline
2
3# Initialize the pipeline (using Object Detection as an example)
4pipeline = create_pipeline(pipeline="object_detection")
5
6# Perform inference on an image URL or local path
7output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image.jpg")
8
9# Print the detection results
10for res in output:
11 res.print()
12 # Save the visualized result
13 res.save_to_img("./output/")
14 # Save the result in JSON format
15 res.save_to_json("./output/res.json")