Hello,

We are currently running the demo program and we were wondering if someone could help us or point us in the right direction in terms of achieving our desired functionality.

We would like to use the Vehicle detection model to detect some cars in the parking lot with the vehicle-detection-adas-0002 model. In addition to that, we would also like to be able to count the detected cars.

We were wondering if there are any pre-trained models for vehicle detection as well as counting the detected vehicle and storing the value somewhere.

Thank you.

  • erik replied to this.

    Hi MuhtasimRidwan ,

    We were wondering if there are any pre-trained models for vehicle detection

    You already mentioned it yourself - the vehicle-detection-adas-0002 model would work great๐Ÿ™‚ I would also check other similar models from openvino model zoo, eg. vehicle-detection-0202, which is heavier but more accurate, which would be ideal as you don't need high FPS for your application.
    For counting, you can easily implement this from the number of detections (demo here). You could also use objectTracker, in case confidence of vehicles isn't very high. Thoughts?
    Thanks, Erik

      Hello erik ,

      As far as utilizing this gen2-people-counter for counting goes; if you don't mind explaining how can I go about running this script for the vehicle detection model? Since the DepthAI-Demo is a completely different repository; did you mean to port this logic into the depthai_demo.py and run it there?
      Or how should I go about using the "number of detection" logic in the depthai-demo.py. I am having a hard time understanding exactly what portion of depthai-demo.py is being utilized to do the vehicle detection to be able to get the counter logic working.

      Thank you for your patience and help. Patiently awaiting your response.

      • erik replied to this.

        Hi MuhtasimRidwan ,
        If you specifically want to use depthai-demo (even though it's not very flexible), I would suggest using callbacks. Otherwise, for more flexibility, I would avoid using depthai-demo. Thoughts?
        Thanks, Erik

          Hello erik ,

          Thank you for your response. We are not married to the idea. Our goal is to be able to detect vehicles from the Oak-1 POE camera (live feed), count the amount of vehicles in the designated parking spots , preferably store that number in a variable and send that number to SQL db.

          So to achieve this functionality; what would you suggest that we do? Any particular existing repo that can provide us with this functionality that you know of?

          I am absolutely new to ML so would appreciate any type of help.

          Thank you, awaiting your response.

          • erik replied to this.

            Hi MuhtasimRidwan ,
            So you could use any kind of MobileNet detection example (eg. this one), change preview size (line 17) to match required frame size of your model, change the model itself (line 32, just change the text to the model you want), and the labelmap (line 10 - I think it could also skip mapping label to text, as you only have 1 class of objects - vehicles). Note that I haven't actually tried this, but it should work. Thoughts?
            Thanks, Erik

              Hey erik ,
              I had a basic question. So it is for setup only. I had previously set up the camera following the depthAI-demo tutorial. This is the depthai-experiments repo. So as far as basic setup goes (like getting the camera feed and environment setup) how would I go about doing this?
              Currently, I have cloned the repo - the POE device is connected thru Ethernet. For this specific repo - how do I go about getting that GUI or how would I connect the Camera to get the video feed in and run the scripts on that?
              If you could please help me out with the setup process. I can send a screenshot of the current repo-directory if needed.
              Patiently awaiting your response.
              Thank you.

              • erik replied to this.

                Hi MuhtasimRidwan ,
                You would just run the python script - there is no GUI, as depthai-demo is the gui, and you would likely want to avoid that. Just run the script and you will see that the video is being displayed (by opencv's imshow function).
                Thanks, Erik

                  Hello erik ,

                  Thank you for your clarification. This makes sense. I will try running $ python3 2-crop_highres.py -cnn "name of the model I would like to use". Here I would like to ask which model should I use since I do not see any specific vehicle detection model in the repo (vehicle-detection-0202 like this one or vehicle-detection-adas-0002 this one mentioned before)

                  Going into the model, from our previous conversations, I would like to use a vehicle detection model with the gen2-people-counter logic (for the count part).

                  So bringing it all together finally - what would be my steps in making this 2-crop_highres.py script to acquire the correct functionality?

                  1. line 17 input the required frame size
                  2. line 32 add the name of the model - this is the model detecting the cars. So a vehicle detection model. However, in the repo I do not see the vehicle-detection-0202 model as discussed before.
                  3. line 10 - change the list to contain only vehicle
                  4. Add the counting logic

                  Is this what you kind of had in mind or am I on the right path?

                  Patiently awaiting your response.

                  Thank you for your help.
                  M Ridwan.

                  • erik replied to this.

                    Hi MuhtasimRidwan ,
                    python3 2-crop_highres.py -cnn "name of the this won't work in that app, as the -cnn argument is added to the depthai_demo. So you would need to use blobconverter package to download the model you would like to run on the camera.
                    Yes, that looks good, let me know if you have any issues!
                    Thanks, Erik

                      6 days later

                      Hello erik,

                      We have been working with the depthai-experiments repo. More specifically working with a modified version of the gen2-people-tracker model to account for the car. We have made progress in detecting cars with the model. Now next problem we are facing is being able to feed the model a live video feed. Currently, the model seems to be taking in a recorded video. I was wondering for this what steps can be taken for the main.py of gen2-people-tracker to work with a live video feed from the camera.

                      Patiently awaiting your response. I can share the code with you if needed.

                      Thank you,
                      M Ridwan.

                      • erik replied to this.