Imageai: How to detect only one object?

Created on 4 Jan 2019  路  5Comments  路  Source: OlafenwaMoses/ImageAI

Hello,
When I use video detection code, it detects all the objects in the scene. 谋s it possible to select specific object from the scene? Thanks very much!

All 5 comments

You can use custom objects detection :

custom_objects = detector.CustomObjects(person=True, bicycle=True, motorcycle=True)

video_path = detector.detectCustomObjectsFromVideo(custom_objects=custom_objects, input_file_path=os.path.join(execution_path, "traffic.mp4"),
                                output_file_path=os.path.join(execution_path, "traffic_custom_detected")
                                , frames_per_second=20, log_progress=True)

More info here :
https://github.com/OlafenwaMoses/ImageAI/blob/master/imageai/Detection/VIDEO.md#custom-video-object-detection

What if it detects 2 birds?

And I want to detect a specific bird?

I just started to use imageAI this week, so I just have a basic understanding.

If you want to detect a specific species of bird, I think you will have to train your own model.

Alternative :
As the forFrame method will return the frame number and the bounding box of each detected object, you will be able to draw a box around a specific object on a specific frame.

[{'name': 'bird', 'percentage_probability': 44.57316696643829, 'box_points': (55, 585, 626, 808)} ...]

Custom trained model can not be used in detecting objects in videos yet, as fas as I understood.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bjente picture bjente  路  3Comments

Combinacijus picture Combinacijus  路  3Comments

bestbugwriter picture bestbugwriter  路  5Comments

Overdoze47 picture Overdoze47  路  3Comments

plenari picture plenari  路  3Comments