MATLAB Answers

How to count the objects after implementing Semantic segmentation ?

1 view (last 30 days)
Hesam Rafiei
Hesam Rafiei on 16 Sep 2020
Answered: Mahesh Taparia on 21 Sep 2020
I have trained a Resnet50 model with pixel classification layer. my model is detecting the objects(cars,vans,truck,pedestrians) on eachframe but now I want to count the total objects on the road and then add weights in Kg for each class to find the total weight of the objects on the road.
the result of my prediction is attached.
Any code example that I can use please?!

  0 Comments

Sign in to comment.

Answers (1)

Mahesh Taparia
Mahesh Taparia on 21 Sep 2020
Hi
You can find the binary image of a class, which consists of background pixels and the class pixels. After that you can use regionprops function to find the connected components of the image. The count of number of components will give the count of number of non overlaped object of that particular class. For overlaped object, you may need to estimate the area of single object and which can divide the region area. This division result can estimate the number of object count.
To find the count of object, objection detection/ instance segmentation is more helpful in compare to semantic segmentation.
Hop it will helps!

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by