google-coral / project-bodypix

BodyPix model demo application for Google Coral
Apache License 2.0
275 stars 52 forks source link

Image import example #7

Closed blackus3r closed 3 years ago

blackus3r commented 4 years ago

Is there any example available which accepts the path to an image and then outputs the number of persons on the given picture?

Namburger commented 4 years ago

Do you mean just counting the numbers of people in an image? Because in that case it's probably much easier to starts with the object detection demo and increment the count each time obj.id == 0 (where 0 mapped to person).

blackus3r commented 4 years ago

Yes, simple counting random people on pictures. I've downloaded the model MobileNet SSD v2 (COCO) from https://coral.ai/models/ but this model does not work very well with our pictures. We wrote a test script in nodejs with tensorflowJS and this worked excellent but the performance wasn't good with our hardware. So we decided to test the coral dev board with the models from this repository.

Namburger commented 4 years ago

@blackus3r I see, mobilenet architect isn't great with small objects, it's possible that the human are too small? We have an example where we worked this out by splitting the image to smaller tiles and do inference on individual tiles before putting everything back together. I'm not sure when it will be released though :/

Namburger commented 3 years ago

Here we go: https://github.com/google-coral/pycoral/blob/master/examples/small_object_detection.py

@blackus3r but back to your og question, you can also just count len(poses) from the outputs of DetectPoseInImage

Naveen-Dodda commented 3 years ago

@blackus3r I hope you are able to run inference on input image to count people. I am closing this for now as you have all the info you need.