OlafenwaMoses / ImageAI

A python library built to empower developers to build applications and systems with self-contained Computer Vision capabilities
https://www.genxr.co/#products
MIT License
8.63k stars 2.19k forks source link

detectCustomObjectsFromVideo() got multiple values for argument 'custom_objects' #527

Closed Sanket307 closed 4 years ago

Sanket307 commented 4 years ago

Hello,

when i try to run customobjectdetection on google colaboratory with gpu getting below error.

Screenshot from 2020-05-01 16-53-57

Please help me to figure it out.

Terizian commented 4 years ago

I think custom_objects takes a CustomObjects object, not a dictionary as you have there.

I would suggest commenting the two lines and writing this: custom_objects = detector.CustomObjects(truck=True)

vinaykumarprabhu commented 4 years ago

@Sanket307 ,

the parameter that needs to be passed should to custom object should have the values mentioned for all the output categories supported by imageai, which in ur case is not i.e. u have specified only {'person':'valid'} Instead u should have done {'person': 'valid', 'bicycle': 'invalid', 'car': 'invalid', 'motorcycle': 'invalid', 'airplane': 'invalid', 'bus': 'invalid', 'train': 'invalid', 'truck': 'invalid', 'boat': 'invalid', 'traffic light': 'invalid', 'fire hydrant': 'invalid', 'stop sign': 'invalid', 'parking meter': 'invalid', 'bench': 'invalid', 'bird': 'invalid', 'cat': 'invalid', 'dog': 'invalid', 'horse': 'invalid', 'sheep': 'invalid', 'cow': 'invalid', 'elephant': 'invalid', 'bear': 'invalid', 'zebra': 'invalid', 'giraffe': 'invalid', 'backpack': 'invalid', 'umbrella': 'invalid', 'handbag': 'invalid', 'tie': 'invalid', 'suitcase': 'invalid', 'frisbee': 'invalid', 'skis': 'invalid', 'snowboard': 'invalid', 'sports ball': 'invalid', 'kite': 'invalid', 'baseball bat': 'invalid', 'baseball glove': 'invalid', 'skateboard': 'invalid', 'surfboard': 'invalid', 'tennis racket': 'invalid', 'bottle': 'invalid', 'wine glass': 'invalid', 'cup': 'invalid', 'fork': 'invalid', 'knife': 'invalid', 'spoon': 'invalid', 'bowl': 'invalid', 'banana': 'invalid', 'apple': 'invalid', 'sandwich': 'invalid', 'orange': 'invalid', 'broccoli': 'invalid', 'carrot': 'invalid', 'hot dog': 'invalid', 'pizza': 'invalid', 'donut': 'invalid', 'cake': 'invalid', 'chair': 'invalid', 'couch': 'invalid', 'potted plant': 'invalid', 'bed': 'invalid', 'dining table': 'invalid', 'toilet': 'invalid', 'tv': 'invalid', 'laptop': 'invalid', 'mouse': 'invalid', 'remote': 'invalid', 'keyboard': 'invalid', 'cell phone': 'invalid', 'microwave': 'invalid', 'oven': 'invalid', 'toaster': 'invalid', 'sink': 'invalid', 'refrigerator': 'invalid', 'book': 'invalid', 'clock': 'invalid', 'vase': 'invalid', 'scissors': 'invalid', 'teddy bear': 'invalid', 'hair dryer': 'invalid', 'toothbrush': 'invalid'} and this would have worked.

And also as mentioned @Terizian if u specify detector.CustomObjects(truck=True) this method actually return a dictionary as mention

Screenshot 2020-05-30 at 3 43 44 PM

ed above.

Hope this _helps.* image

Sanket307 commented 4 years ago

Thanks for your comments.

Issue solved, As i am replacing original script but it is not replaced in colab so it generate error.