How did I Make Large Crowd Analytics and Tracking with AI? Using YOLO V3, SORT, OPENCV AND PYTHON

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • By OpenRemote we where tasked to create a real time crowd detection and tracking module which would extract data like speed and direction and show this data inside the OpenRemote manager.
    How did we manage to do this? Watch the video above!
    Links:
    CODE: github.com/ope...
    Make sure to use the exact link above. This is because currently work is done on the project. When recording this video I used the project version with commit "d343e883cc0056acb6b37cde644eca06128a8a44". This version can be accesses using the link above! You could also try the newer version but because I am not working on the newer version I don't know how it will work.
    For instruction to install the manager check the readme.md file in the github!
    Credits:
    Api communication: / adlnc
    Gui implementation: Rezhep
    Video detection and analytics: / sieuwe-elferink-a193a9157

Комментарии • 127

  • @sieuweelferink6852
    @sieuweelferink6852  4 года назад +33

    Are you interested to see automated event recognition? Like for example a person is running or a fight is happening between persons? Let me know!

    • @donhsi
      @donhsi 4 года назад +1

      Might be interesting to apply this for sports - basketball, soccer, ...

    • @terblanchedaniel5241
      @terblanchedaniel5241 4 года назад

      Would def want to see this!

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад +1

      @@donhsi You mean anlysing how a team plays football using a camera? like what positions players are often standing, What speed players are running, How often players get close to each other?

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад +1

      @@terblanchedaniel5241 I am now working on a project where i am making a autonomous vehicle drive over public roads with ai for road detection and a drive model which uses ai for steering an throttle. After that project I will focus on making this!

    • @donhsi
      @donhsi 4 года назад

      Sieuwe Elferink yeap, think basketball or scoccer, automatically track each player for video_on_demand, or player analysis combing their position and speed...

  • @user-sp6uo6kn7n
    @user-sp6uo6kn7n 7 месяцев назад

    Interesting project, imagine this method can implement in car to avoid collision😊

  • @24-7Pain
    @24-7Pain 4 года назад +1

    Please do a video on event/anomaly detection, I can't explain how helpful this is, thanks so much

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      I am now working on a new drone project. Will work on this after that!

    • @24-7Pain
      @24-7Pain 4 года назад

      @@sieuweelferink6852 Thanks :D looking forward to it

  • @chingleung771
    @chingleung771 4 года назад

    you saved my graduation project!! THX!!!!

  • @johanneszwilling
    @johanneszwilling 2 года назад

    😎 Thank you, Sir!!

  • @PALTUBABY
    @PALTUBABY 4 года назад +1

    great work and thanks for open sourcing it :)

    • @PALTUBABY
      @PALTUBABY 4 года назад

      Would love to get connected with you professionally. I also graduated from TUe. Have sent you connection request in linkedIn

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад +1

      Thanks for your request. I am still on fontys in eindhoven for some time but will accept your request.

  • @MrPkmonster
    @MrPkmonster 4 года назад

    Great work. Thank you for sharing code.

  • @utkarshay
    @utkarshay 3 года назад +3

    how to store the results over cloud or google drive ?

  • @meetparikh9336
    @meetparikh9336 3 года назад

    Very Helpful!

  • @siddharthrana512
    @siddharthrana512 Год назад

    Hi Sieuwe , what i have noticed that when person cross each other or overlap their identity changes , so how to keep their identity constant.

  • @abighizha
    @abighizha 4 года назад

    Magnificent

  • @19daredevill
    @19daredevill 4 года назад

    nice work.. keep up the good work.

  • @calebmunuru3598
    @calebmunuru3598 3 года назад

    Good stuff sir!

  • @estherkasyoki2645
    @estherkasyoki2645 3 года назад +3

    Great work sir! I want to count the number of people entering a room using raspberry pi camera module. How can I achieve that?

    • @germanbuzzi621
      @germanbuzzi621 3 года назад

      hola esther. has logrado encontrar solucion para tu necesidad de contar personas en una sala?

  • @devil_mlt
    @devil_mlt 3 года назад

    Hi Sieuwe. Nice work indeed. Do you mind sharing which libraries were used and which version please because I'm trying to built up this project and I'm encountering multiple issues. Thank you and well done.

  • @user-fu5js5sc3m
    @user-fu5js5sc3m 6 месяцев назад

    what are the exact infra requirements to run this code ?

  • @georgpopp1292
    @georgpopp1292 4 года назад +1

    Thanks for sharing this! Will it also work on Windows 10?

  • @Blipstream
    @Blipstream 3 года назад

    Did some more digging through my jetson nano.. now terminal throws up "Illegal instruction (core dumped)"

  • @user-sc6lo4kt8s
    @user-sc6lo4kt8s 4 года назад

    Nice video!

  • @akshayrawat2477
    @akshayrawat2477 2 года назад

    thanks this was very helpful. Keep up the good work

  • @malithaperera9801
    @malithaperera9801 2 года назад

    can u explain how to social distance detecton using visual ? i need for my project

  • @justdrinkcoca
    @justdrinkcoca 4 года назад

    Iam still having problem cropping the detected object im working with my own code can u figure out my problem?
    if not track.is_confirmed() or track.time_since_update > 1:
    continue
    bbox = track.to_tlbr()
    i can draw a rectangle around the detected object with cv2.rectangle(img, (int(bbox[0]), int(bbox[1])), (int(bbox[2]), int(bbox[3])), color, 2) but i cant crop it

    • @akilamariappan9507
      @akilamariappan9507 3 года назад

      hi, can u help me out to fix the issues? am in windows 10 - i can stream webcam vid and green line but object/person are not detected ! can tel what may be the issue?

  • @Kishi1969
    @Kishi1969 2 года назад

    Sir...I did the same but its telling the same errors

  • @t.z.7659
    @t.z.7659 3 года назад

    Is it possible to use Yolo for peron detection when persons are far from the camera? I mean they are small part of the frame

    • @sieuweelferink6852
      @sieuweelferink6852  3 года назад

      Yes if you look at the demo you can see that even people far away are detected. But this will be depended on resolution off course. Higher resolution means more details means better detections. Yolo performs best with large objects in the view so best to make sure people are large in the camera view.

  • @Kishi1969
    @Kishi1969 2 года назад

    Great Lecture and well educative.
    Please can u get in touch because there are many problems along after installing all requirements with CUDA and Torch , its still telling they are not Compatible ..
    raise AssertionError("Torch not compiled with CUDA enabled")
    AssertionError: Torch not compiled with CUDA enabled
    Please kindly get in touch in response

  • @HabibUrRahman-mu8zf
    @HabibUrRahman-mu8zf 2 года назад

    how to train on custom data?

  • @Tommywu052
    @Tommywu052 4 года назад

    Hi , Thanks you first. How about the AGV project you mentioned? Anything could be shared with?

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад +1

      Hi sorry for late reply but here is the repo github.com/sieuwe1/Advanced-Real-Time-Self-Driving

  • @tomdedula8279
    @tomdedula8279 4 года назад

    Thanks for sharing this very impressive software! I came across your video while trying to learn more about OpenCV and Yolo. I am looking for a way to process video from a security camera to look for object movement. I use a Raspberry Pi for motion detection but it picks up the shadows from moving trees. Do you know where I might find software that will take an existing video and only keep the parts where there is object motion such as cars and people? I was able to get OpenCV and Yolo running with object but not the motion detection. I was expecting to find a lot with a Google search but could not find what I was looking for. If nothing is available what software would you suggest using to build something like this?

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      Hi so you want to make a alarm go off once there is movement in the camera image?

    • @tomdedula8279
      @tomdedula8279 4 года назад

      @@sieuweelferink6852 With my setup I have several Raspberry Pi cameras in a window running motion detection software. The software is good at blocking on areas where there are trees moving but picks up shadows as movement. I download the videos to my Linux server every hour for archiving. If I want to review the video and it is a windy day outside I have to go through a lot of moving shadows from the trees. My assumption is it is not possible to do true object detection on a Raspberry Pi due to limited processing power. I would like to use the downloaded video on my Linux system as input to something that will look for people, cars and animals and then copy only the video that contains objects of interest. Is this possible?

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      Tom Dedula i suggest you use my code and changes some parts. First change that all classes you want are detected. We only detect the class person but yolo is trained on much more! Then use the list of centerpoints to calculate for each defected id if the total delta between the centerpoints from that id is larger than a threshold. If this is the case then do a opencv write or use a videowriter which gets assigned to each id to save the object. Using an ai network to perform detection will make you able to perform much more accurate and reliable detection of objects but will cost processing power. Maybe look at a jetson nano.

  • @hariskkk7106
    @hariskkk7106 3 года назад

    Great work. I wanna ask do we run this without having gpu?

    • @sieuweelferink6852
      @sieuweelferink6852  3 года назад +1

      That won’t be possible. Yolo is a very computational intensive neural network. This means it needs a lot of parallel processing power from a GPU. If you are looking to run this in a small form factor envoirement look at the jetson nano. Can run yolo tiny at around 23fps if you get the 4gb version. Fps for this project will be lower since the calculations are done in the video loop. Probably close to 15/20fps on jetson nano.

  • @rasheedstotomas2879
    @rasheedstotomas2879 3 года назад

    we would like to use this for our capstone project and add a person distance alarm for social distancing, is there any way we can contact you and ask for your help?

  • @souhaielbensalem2194
    @souhaielbensalem2194 4 года назад

    great work ! will I be ablle to deploy the model on windows 10 using cmd or should i use ubuntu on a virtual machine ?

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад +1

      I would not reccomend any of those options. I have not tested it on windows so I am not sure how it would work there. And secondly for the vm I would not reccomend that either because of overhead and I am not sure how well the Cuda support for vm is right now. I suggest you install Ubuntu alongside windows 10. there is a easy automatic installer which can do that for You. Good luck

    • @agilcalfarera
      @agilcalfarera 4 года назад

      @@sieuweelferink6852 so mister this program won't work on Windows 10?

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      Agil Calfarera you could try it. I believe there are some that made it work. But I know it works on Ubuntu so best to use that.

    • @agilcalfarera
      @agilcalfarera 4 года назад

      @@sieuweelferink6852 I have try to use it in my laptop that using windows, but I don't know if there some requirements that I have to complete before using it because its run on windows. Is the way to use it on windows is the same as on your video? Thanks

    • @hariskkk7106
      @hariskkk7106 2 года назад

      @@agilcalfarera have you run this on windows?

  • @mohsinrasul7140
    @mohsinrasul7140 3 года назад

    python3 gui.py
    File "gui.py", line 208
    print(classlist)
    getting error: TabError: inconsistent use of tabs and spaces in indentation
    on Windows

    • @sieuweelferink6852
      @sieuweelferink6852  3 года назад

      Could be a windows only error. I have not tested it on windows. Try removing the code at line 208 and try again. If it does not work you could also launch using start.py

    • @mohsinrasul7140
      @mohsinrasul7140 3 года назад

      @@sieuweelferink6852 will do and report- cheers

  • @shaopengcui6909
    @shaopengcui6909 4 года назад

    Hello, how to show up the detection accuracy of object?

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      Yolo returns a array/ tuple with all the information from its detections. Go to line 56 in tracker.py. Here is a tuple called detection where also the accuracy is in. Just go to the yolo website what format the tuple is in and then use that information to get the accuracy.

  • @Meego_007
    @Meego_007 4 года назад

    man thats really awesome. do you have some small projects that i can participate and learn with you ? (like some kind of inteership ?)

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      Thanks! I am just a student doing some fun projects in my freetime. So I dont have a internship possibility like a company. Just search online for ideas and try to create them.

    • @akilamariappan9507
      @akilamariappan9507 3 года назад

      @@sieuweelferink6852 Goodmorning, i tried the code, got partial output - can u please help me out with my doubts it will very helpful.

  • @akilamariappan9507
    @akilamariappan9507 3 года назад

    Hi, i tried this coding in windows 10, actually am getting partial output. i can stream the live video through web cam, and green color line in the middle of the frame is also coming. but person is not detected with bounding boxes and also parameters are displaying but count is not changing.

    • @hariskkk7106
      @hariskkk7106 3 года назад

      hello, have you tested it on pre-recorded videos?

    • @akilamariappan9507
      @akilamariappan9507 3 года назад

      @@hariskkk7106 Yes, do u have any solutions for this? i tried with recorded videos also .. vid is streaming, green line is also coming. but object is not detected yet...

    • @hariskkk7106
      @hariskkk7106 3 года назад

      @@akilamariappan9507 run it through main program.

    • @akilamariappan9507
      @akilamariappan9507 3 года назад

      @@hariskkk7106 object is not detecting, can u please share the procedure for the set up and code?i have spent a lot of time in this.

  • @LoveLove-mi9ne
    @LoveLove-mi9ne 4 года назад

    Is there a way to use this on windows?

  • @herbertriener259
    @herbertriener259 4 года назад

    Hey, is it possible to run this project on a raspberry pi 4 with 4gb RAM?

  • @ewout4890
    @ewout4890 4 года назад +3

    3:47 hoe vind je nou het juiste mapje ooit nog terug dan😂😂

  • @justdrinkcoca
    @justdrinkcoca 4 года назад

    Can you please help me save only the image of the detected object in the video i use cv2.imrite but it takes a picture of all the frame i want just whats inside the bounding boxes of the object

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      yes that is correct that is why I gave you that link in my previous comment. You need to create a roi with the location of the bounding box. The x y width and height . Then save this roi with imwrite. You can get the x y wift and height at line 166 of tracker.py.

    • @justdrinkcoca
      @justdrinkcoca 4 года назад

      Sieuwe Elferink can you please pass me the link i lost the previous comment

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      @@justdrinkcoca answers.opencv.org/question/29260/how-to-save-a-rectangular-roi/?sort=votes

    • @justdrinkcoca
      @justdrinkcoca 4 года назад

      @@sieuweelferink6852 thank you so much

    • @akilamariappan9507
      @akilamariappan9507 3 года назад

      Hi, can u please help to fix the issues.. , i can stream video and green line is also coming in both the pre recorded vid and even web cam live vid - but object is not detecting.what may be the problem?

  • @utkarsh223
    @utkarsh223 3 года назад

    I am running it on windows, the program is not detecting anything

    • @hariskkk7106
      @hariskkk7106 2 года назад

      Have you solved this problem?

  • @jokosusilo303
    @jokosusilo303 4 года назад

    Can we run it on video? or is it only work from camera live video? Sorry, I am new in python

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад +1

      You can run it also from prerecorded video. Then change the line at cv2.videoCapture() to cv2.videoCapture('path to video file' )

    • @jokosusilo303
      @jokosusilo303 4 года назад

      @@sieuweelferink6852 Thanks a lot for the reply. One more question please. How to crop each object detected inside of the bounding box into the image file? Thanks is advance

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      @@jokosusilo303 use this answers.opencv.org/question/29260/how-to-save-a-rectangular-roi/?sort=votes

    • @shaopengcui6909
      @shaopengcui6909 4 года назад

      @@sieuweelferink6852 Hello, I also want run it from prerecorded video. And gui.py file running is ok. But after I run start.py, the terminal just no results. Thank you in advance.

    • @IndrajitShinde
      @IndrajitShinde 3 года назад

      @@shaopengcui6909 can you make a small video regarding how you install all the dependcies on ubuntu and how you run this project it would be reallly benefecial..

  • @shubhamsingh-fc2ge
    @shubhamsingh-fc2ge 4 года назад

    did u use cuda 10 or cuda 11?

  • @RenatoSoftllution
    @RenatoSoftllution 4 года назад

    Amazing job! How fast did you get in fps in real time video?

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      Got around 20/30 fps on gtx2070 super with max 60% gpu usage. fps depends on how many people are in the view

  • @utkarshay
    @utkarshay 3 года назад

    will this work on windows 10 ?

    • @sieuweelferink6852
      @sieuweelferink6852  3 года назад

      It has been shown to work. Will however take some debugging.

  • @sacation6057
    @sacation6057 4 года назад +1

    First!

  • @deveshdashore5918
    @deveshdashore5918 4 года назад

    Awesome work.
    I am facing some problem figuring out dependencies. I would be very grateful if you share requirement file or a docker image so that it would be easy to setup.
    I am trying to run this code on Windows.
    Thank you in advance

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      hi
      requirements are in the github Readme. What errors do you have?

    • @deveshdashore5918
      @deveshdashore5918 4 года назад

      @@sieuweelferink6852 sorry for the late reply I am facing some runtime error. I am new to all this stuff
      Traceback (most recent call last):
      File "C:\Users\De\AppData\Local\Continuum\anaconda3\envs\gpu\lib\threading.py", line 916, in _bootstrap_inner
      self.run()
      File "C:\Users\De\AppData\Local\Continuum\anaconda3\envs\gpu\lib\threading.py", line 864, in run
      self._target(*self._args, **self._kwargs)
      File "Z:\DEEP_Learning\original files\Yolo based model\using GPU\or-objectdetection\YOLO_DETECTION\tracker.py", line 155, in yoloWorker
      tracked_objects = mot_tracker.update(detections.cpu())
      File "Z:\DEEP_Learning\original files\Yolo based model\using GPU\or-objectdetection\YOLO_DETECTION\sort.py", line 208, in update
      matched, unmatched_dets, unmatched_trks = associate_detections_to_trackers(dets,trks)
      File "Z:\DEEP_Learning\original files\Yolo based model\using GPU\or-objectdetection\YOLO_DETECTION\sort.py", line 147, in associate_detections_to_trackers
      iou_matrix[d,t] = iou(det,trk)
      RuntimeError: Expected object of type torch.FloatTensor but found type torch.DoubleTensor for argument #3 'other'
      Thank you in advance

    • @deveshdashore5918
      @deveshdashore5918 4 года назад

      Hello, the problem is solved by updating the pytroch version. but still detected bounding boxes are not aligning with the object.

    • @sieuweelferink6852
      @sieuweelferink6852  4 года назад

      @@deveshdashore5918 sorry for late reply is it already fixed? may be that the resolution is not correct. then the bounding boxes are not aligned.

    • @souhaielbensalem2194
      @souhaielbensalem2194 4 года назад

      hey
      devesh , can you please tell me how did you run the program on windows ? (the steps)

  • @ameerbaig1754
    @ameerbaig1754 Год назад

    Can i have your email

  • @user-sp6uo6kn7n
    @user-sp6uo6kn7n 7 месяцев назад

    Interesting project, imagine this method can implement in car to avoid collision😊

  • @bdoriandasilva
    @bdoriandasilva 4 года назад

    very good work! thanks for sharing this!

  • @rahulgaius.c1546
    @rahulgaius.c1546 2 года назад

    how to train custom data?