Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6430 Discussions

change label based on the object & counting the object ( Object Detection C++ Demo )

rnd-amg
Beginner
1,135 Views

Hi Team,

i used pedestrian-and-vehicle-detector-adas-0001.xml models and i have a questions

1. how if i want change the name label of the object based on type the object examp. car or bicycle

rndamg_0-1659494477910.png

 

2. how if i want counting all the object based on type

 

how to customize the code, need your advice

Regards,

rnd

 

0 Kudos
8 Replies
Hairul_Intel
Moderator
1,095 Views

Hi rnd,

Thank you for reaching out to us.

 

To answer your first question, you can run the Object Detection C++ Demo with -labels command to change the default labels of the model. The labels file can be written in a simple text document file (.txt file) corresponding to the label ID of the detection.

 

For your information, the pedestrian-and-vehicle-detector-adas-0001 detects pedestrians and vehicles only as described in the Outputs which are predicted class ID (1 - vehicle, 2 - pedestrian). Thus, the contents of your labels text file should look like this:

labels.png

 

 

Here is the result of the Object Detection C++ Demo using pedestrian-and-vehicle-detector-adas-001 model with -labels command:

result.png

 

 

For your second question, I'd suggest you refer the Pedestrian Tracker C++ Demo and have an understanding on how the codes work so that you can try to implement those features into your own project. On another note, there are plenty of tutorials available on the internet which can also serve as references for your project.

 

Here are a couple of references for you to explore (These are external links and are not maintained by Intel):

  1. OpenCV People Counter with Python
  2. OpenCV 3 Car Counting C++

 

 

Regards,

Hairul

 

0 Kudos
rnd-amg
Beginner
1,078 Views

Hi @Hairul_Intel ,

 

as u can see at capture below the labels already change but sometime the pedestrian detected as motor or the bus detected as car 

rndamg_0-1659669807414.png

rndamg_1-1659670031796.png

my questions :

1. how the object get the label?because if i change the position/index .txt the object name will change

2.  how if i want detect the bus as a bus?customize the code size or what?

regards,

rnd

0 Kudos
Hairul_Intel
Moderator
1,050 Views

Hi rnd,

Regarding your first question, I've explained in my previous reply that the model will identify only two classes which are (class ID 1 - vehicle) and (class ID 2 - pedestrian). However, we also need to include class ID 0 (background) into the labels text file.

 

Thus, the demo will read only three lines of the text file starting from class ID 0 (background) followed by class ID 1 (vehicle) and finally class ID 2 (pedestrian). Arrangements of the labels needs to follow the order of the class ID as shown below:

labels_id.png

 

It is important to note that any additional lines after the final class ID 2 (pedestrian) will not be read for the pedestrian-and-vehicle-detector-adas-0001 model.

 

 

For your second question, please understand that the pedestrian-and-vehicle-detector-adas-0001 model is trained for identifying only two objects (vehicle and pedestrian).

 

You can try searching on the internet for a model that will fit your criteria such as identifying between multiple vehicle types (bus, car, etc..) and also pedestrian. Otherwise, you would have to custom train a model yourself.

 

Here is a great tutorial video on training and deploying custom object detection model for your reference:

Train a custom object detection model using your data (This is an external link and is not maintained by Intel).

 

 

Regards,

Hairul

 

 

 

0 Kudos
rnd-amg
Beginner
1,024 Views

Hi @Hairul_Intel ,

 

can i customize " pedestrian_and_vehicle_detector_adas_0001 " model code, because i want change the objects? if can which files?

 

regards,

rnd

0 Kudos
Hairul_Intel
Moderator
1,002 Views

Hi rnd,

For your information, the Intel’s Pre-Trained Model pedestrian-and-vehicle-detector-adas-0001 is available in Intermediate Representation format (.xml and .bin files) only.

 

Unfortunately, the model cannot be used for retraining purposes as the non-IR version of the pretrained model is not publicly provided.

 

 

Regards,

Hairul


0 Kudos
rnd-amg
Beginner
996 Views

Hi @Hairul_Intel 

 

any similars models that publicly provided?or any similars models with source code soo i can customize it?

 

regards,

rnd

0 Kudos
Hairul_Intel
Moderator
967 Views

Hi rnd,

OpenVINO™ Open Model Zoo does not provide a specific model that fits your criteria for differentiating between vehicle types (bus, car, etc..) and also pedestrian. Hence, you would need to custom train your own model to achieve those detections.

 

The Intel’s Pre-Trained Model pedestrian-and-vehicle-detector-adas-0001 was based on mobilenetv1+ssd backbone. Therefore, you can custom train a mobilenetv1 model to fit your requirements as the model is validated for OpenVINO™.

 

On a side note, I've proactively searched from my end for vehicle type detection models and managed to find this GitHub repository (This is an external link and is not maintained by Intel) which you can use as reference.

 

 

Regards,

Hairul


0 Kudos
Hairul_Intel
Moderator
928 Views

Hi rnd,

This thread will no longer be monitored since we have provided a solution. If you need any additional information from Intel, please submit a new question.

 

 

Regards,

Hairul


0 Kudos
Reply