Closed amaadmirza closed 5 years ago
mean if you separate count car, separte count truck and separate count bus when they cross the ROI
Okay. It's possible. You can return bounding boxes along with the classes of objects detected. While this is easy to do, I feel it'll complicate the application as a whole. Any specific reason why you want this? I think a better approach would be to save images of each vehicle once counted to be processed by another program solely created for vehicle classification. Images may also be used for other purposes such as vehicle identification (ANPR).
@nicholaskajoh it would be great if you could tell where exactly to return the claass of the object?
You can return the classes in _detectors/yolo/yolodetector.py like so:
_classes = [] # step 1
for output in outputs:
for detection in output:
# ...
if confidence > 0.5 and classes[class_id] in classes_of_interest:
# ...
classes.append(classes[class_id]) # step 2
# ...
return _bounding_boxes, _classes # step 3
Can you throw more light on what exactly you want to accomplish? Some detectors (
yolo
,ssd
) can classify vehicles, others can't (bgsub
,haarc
). It's just a matter of changing a few lines of code to get the classification working but I need to know what you want to do/have in mind.