I recommend using updated version of the notebook: colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-track-and-count-vehicles-with-yolov8-and-supervison.ipynb
It goes to show how streamlined this stuff has become. Try doing a PhD in this ten years ago and having to write your own code for everything AND the novel parts you're working on. Takes months and hours to explain. Now anyone can git clone and run complex models. What a world :)
Hi it's Peter from the video! Wow! I didn't know that. Now you made me look and here is what I found: tqdm derives from the Arabic word taqaddum (تقدّم) which can mean “progress,” and is an abbreviation for “I love you so much” in Spanish (te quiero demasiado).
TY for your great work on supervision library. I have modified your line counting algorithm. During counting people from indoor cctv camera, lines stay short to meet counting conditions. Firstly, I tried center dot instead of corners of bb, but it become unstable, especially when a person pass from door, because center of rectangle become unstable while object slowly disappear. Finally, I draw a square at center of object. It fits my case and generate stable countings.
Thank you so much.. I have Zero experience on this matter but following each of your instruction and I did finish my project with my own video.. Super!
Hello Piotr @roboflow, thank you for the video. I have trained my model on 3 different classes.Would it be possible to have the line zone annotator display the count of each class separately rather than the sum of detections of all classes? Can you please help with this?
@@SkalskiP As always amazing job! One problem I am facing inside match_detections_with_tracks function, when the object is not in frame and model return emtpy list this line gives error iou = box_iou_batch(tracks_boxes, detection_boxes) How can I solve it?
Hi! This is Piotr from the video. This is something that is on my mind for a long time. And yes, having some reference object at least to calibrate measurements would be mandatory.
Did you used latest version of our notebook? colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-track-and-count-vehicles-with-yolov8-and-supervison.ipynb
I really need help for one thing. How can you show the specific number of cars and trucks that have gone in and out. For example: 3 cars and 1 truck in and 5 cars and 1 truck out
We don't have a dedicated feature yet, but you can build a workaround solution. Create two separate line counters. Filter detections by class, to get car and truck detections and trigger one line counter with car detections and the other with truck detections.
It's Peter from video. I'm not sure if I'm YOLO guru, but thanks a lot for this kind comment. I went through a bit of internet hate lately, so it is great to here some positive feedback.
Thank you for the amazing video! Is it possible to invoke yolo8 on every 4th frame (for example), instead of every single frame? And have some kind of other system follow the object in the other 3 frames (to save on resources).
Not to my knowledge. You skip the frame completely or not. All of those trackers depend on boxes being generated by the model. That being said you can try to pass detections to tracker every 4th frame. It all depends on input video but could still work.
nice and simple explanation. i am a beginner and i am trying to start with something simpler like object detection and counting i a picture how would i go about this?
Great video! However I tried implementing it with more than one counter (one for each lane) but it seems that LineCounter is a global variable shared across all other lanes. is there a way to overcome this? Thank you!
Hello! I have a question, how does the model interpret the "out" variable in the candy example? Can it make the difference between if the object is moving to the right or left? Because of how the bounding box is approaching the line? And thank you so much for creating this content!
Hello Piotr @roboflow , I'm so very thankful for this insightful video i just wanted to know how do you consider the coordinates for the custom dataset like is there a method or just intiution
@@Roboflow What I meant is you draw out polygons for the polygon zone or line zone. How do you do that like the exact numbers in the numpy array.. You also showed a project for candy counting and tracking on conveyor belt. I couldnt find your video so i found similar in youtube made a dataset trained it but after that i couldn't make coordinates for the "line" based on which if the candy crosses the line its in and count increases.. So basically to sum it up How do one calculate the numpy array for the polygon zone?
Hola tengo el error en la parte del código : tracks = byte_tracker.update( output_results=detections2boxes(detections=detections), img_info=frame.shape, img_size=frame.shape ) ;sale este error: AttributeError: module 'numpy' has no attribute 'float' ;pueden ayudar porfavor
@@manuelnavarrete4509 si ..antes de ejecutar el código agrega esta línea : !pip install -U numpy==1.23.5 ;después te pedirá reiniciar la sesión ,vuelves a ejecutar el código ya sin volver a instalar el numpy y listo
Great video! How do I customize the counter? For example, position it in the corner of the screen, count cars, trucks, and motorcycles with their own counters? Thank you!
Thank you very much, really appreciate! I applied to my custom video, it does not count correctly. I saw in your video it also does not count correctly, how we can improve it?
Hi! That video was actually recorded before YOLOv8 team added tracking capability. But in short, you can use ByteTrack with any object detection model, and if you will use Ultralytics implementation then you are bound to use only YOLOv8.
Thank you for the video. It's really helpful. Is there any way to detect time stamp in the video to capture at what time Vehicle crosses the count line. It will be a great help.
@@Roboflow Thank you for your reply. Stream. Recorded footage of traffic with timestamp in it when it is recorded. It's similar to the Video used in your explanation.
I really enjoyed the last episodes, very well and comprehensibly explained! Thanks! Would it be possible to make a video about rotated object detection in YOLOv8? Would be very useful.
Thanks for the video, it has been quite useful! I want to export the Tracking data as a CSV file. Specifically, I want to run the MOT evaluation toolset in order to evaluate my own dataset. Thus, I was wondering how I could correctly export each objects detection, its bounding boxes, confidence and so on for each frame. Any help would be greatly appreciated :))
We will actually release a new video this week. It will be about detections time analysts. But in this video we will show you how to save detections as csv. Stay tuned.
Any news on the new video so far? I am really struggling to make sense of analyzing the ByteTrack on the MOT toolset. The codebase that ByteTrack provides is just so faulty and has zero guidance@@Roboflow
@@Roboflow I am working on Water Pollution Detection Project and I have a dataset of images of different types of pollution, my goal of this project is that I need to train Yolov8 model on that dataset and model should be able to classify the type of pollution.
For classification into car, bus, truck and motorcycle which one is used ByteTrack or Supervision? Additionally, is Bytetrack also used for counting along with tracking? Because supervision is used for annotations.
Brother, I watched your Object detection for a custom dataset video, it's awesome. I trained with my own dataset and it works like magic. Now, if I want to calculate the time , an object appears in a video, how can I do that? Then, is it possible to do the same for different objects and plot them as graph with Time in y-axis and the type of object in x-axis?
Thank you for the video! What is the specs of your computer? I want to calculate how long it would take to execute this computer vision method on a jetson Nano
I was doing this experiment on google colab. You are pretty much bound to performance of YOLOv8 on Nano. With small model it should be close to real time.
our project is to detect and count the object on the captured photo. can we follow this tutorial? or is there other more applicable tutorial we can follow
Great video, i have a question in this video the linecounter from supervision will increase when all line from prediction box is through the line. Can you change it so just from bottom line / top line??
Thank you for this video, it's very explanatory. However, the supervision library has been updated, so these codes don't work anymore. I tried to get all those supervision utils from the documentation with little success after a couple of hours. Could you please , make a video dedicated to supervision library alone and where to find those functions and classes and what each one is used for. That will be very helpful. Thank you once again.
Thanks for your interesting video. Could you make a video to compare YOLOv8, YOLOv7, YOLOv6 for object detection and object tracking? That would be great!!!
Interesting idea! Do you think it is worth comparing them they are all super close regarding accuracy and speed. What sort of benchmark are you mostly interested in?
thanks for the video. I noticed that even with a clear view of all the vehicles, you still lose track of the truck and it gets a new id. Is there a way to limit the number of ids that the objects get so that this doesnt happen? for example you only have 4 possible labels during the video and the algorithm has to select the most likely label when tracking.
Is is possible to solve those issues. Or to at least make them less frequent. But potential solutions are usually strictly tied to use-case that you are trying to solve. In our case you can notice that those id changes are happening only when cars are still far away or when they are partially ocluded by this large metal object hanging over the left lane. Thats why I would propose to discard objects that are in top half of image and only take into account those that are in bottom half - closer.
I have one question: Since we are trying to count the objects and since the Object's id given by the tracker are unique, why can't we just count the last Id or count the different number of ids?
it is possible to perform object tracking using YOLOv8 with a focus on two specific objects out of the 10 that the model detects. The code can be modified to track only those two predefined objects, providing you with the ability to monitor their movements and positions across frames. If you could provide additional details about the two objects you wish to track, I can assist you in adapting the code accordingly.
I have followed the code provided and the program runs well as shown in the video. If I want to count vehicles according to each class, such as the number of motorbikes and the number of cars. How and which parts should I change in the code? Thank you
thank you for the tutorial, very easy to understand! I have a question, how do I get the CSV file result to find out the coordinates of the bounding box?
I'd like to use computer-vision + AI, to inspect Printed-Circuit-Boards.. is the best approach one that trains the model on good and bad examples? Any thoughts on open source approaches, like PCB-Defect-Detection (YOLOv5, RNCC, etc), PCB-Inspection-OpenCV, versus enterprise tools (KollerFacts Inspection, Intuitive Machines Defect Detection, SVI Defect Analyzer, Cyient Inspection, Mentor Tessent YieldInsight).
@@Roboflow Sometimes the component is not perfectly square on the pads.. or even lifted like a tombstone. Other times the defect is a bit harder to spot, like cold solder, or too much solder that there's a short between pins!
Dear friend, Thank you for presenting that great stuff. Is there a way to count the separate types of vehicles crossing the line? Unfortunately, I am not able to handle that, even after creating a separately updated line_counter for each vehicle type inside the for loop. I appreciate any help you can provide.
@@Roboflow Thank you for suggesting that - nevertheless, I figured it out. Everything works well after adding the following code for each class I want to detect: ## Recognition of class 2 (cars) detections = Detections( xyxy=results[0].boxes.xyxy.cpu().numpy(), confidence=results[0].boxes.conf.cpu().numpy(), class_id=results[0].boxes.cls.cpu().numpy().astype(int) ) # Masking of undesired classes mask = np.array([class_id in CLASS_ID for class_id in detections.class_id], dtype=bool) detections.filter(mask=mask, inplace=True) #Tracking of Objects tracks = byte_tracker.update( output_results=ostrukt(detections=detections), img_info=frame.shape, img_size=frame.shape ) tracker_id = match_detections_with_tracks(detections=detections, tracks=tracks) detections.tracker_id = np.array(tracker_id) # Extraction of not tracked but recognised objects mask = np.array([tracker_id is not None for tracker_id in detections.tracker_id], dtype=bool) detections.filter(mask=mask, inplace=True) # Labeling of object characteristics labels = [ f"#{tracker_id} {oklassen[class_id]} {confidence:0.2f}" for _, confidence, class_id, tracker_id in detections ] # Increasement mask = np.array([class_id in [2] for class_id in detections.class_id], dtype=bool) detections.filter(mask=mask, inplace=True) line_counter_car.update(detections=detections)
Sorry. I didn't express myself correctly. Can I add my classes to the pre-trained weights. For example, I have my own class Y, and I want the model to recognize both classes with coco dataset and class Y.
@SkalskiP As always amazing job! One problem I am facing inside *match_detections_with_tracks* function, when the object is not in frame and model return _emtpy list_ this line gives error *iou = box_iou_batch(tracks_boxes, detection_boxes)* How can I solve it?
Suuperb... What if I want to detect and track the faulty chocolates in that video and mark the chocolate faulty until it leaves out the frame? Any thoughts on this?
@@Roboflow No, currently I have a model to detect potatoes on a conveyer belt. For detecting defects I'm thinking of using OpenCV to detect color deviations. My problem is since potatoes keep rotating on the conveyer belt, I want to track the defective potato even if it keeps rolling.
Hey Peter! Any thoughts on this? And also, Just now saw your video on Grounding DINO it looks interesting. What are your thoughts on using it to detect rotten/spoiled potatoes as explained in earlier comments.
@@snehitvaddi sorry I missed your comment. If you have images of rotten potatoes you can try if DINO detect it. Sounds like something that should work. Color range is doable as well, just pretty hard to get right color ranges I think :/
Thank you for a very good explanation. I found that YOLOv8 has their own tracking command both CLI and python mode. I tried on CLI mode, it works well. but unfortunatly in python mode, ID always reset to id 1. Now I am thinking of using ByteTrack as you did or do you have any idea of using straight forward way to use YOLOv8 to tracking object. Thanks, Nott
Thanks! I'm still a beginner, so this is very confusing. So I have one question: I can't use 'best.pt', the model trained with yolov7, in this tutorial, right?
How to check its performance because we always need accuracy, precision and other metrices to find the performance of the model ?, Do I need to annotate first then calculate the accuracy?
Thanks for information. By the way, I could not understand about the BYTETracks classes. In particular, I've tried adjusting the parameters aspect_ratio_thresh and min_box_area, but there wasn't a significant change. I would appreciate it if you could explain the specific meanings of these parameters. I hope to receive a prompt response. Thank you!
Hey there, thanks for the amazing YOLO 8 videos, I run the code for object detection and it was work fine. then I tried to run for instance segmentation. all steps are fine but in the final step when I run the code for Inference with Custom Model, code run without any issue but this message did not appear: Results saved to runs/segment/predict2. do you know what is the problem?
I need 101% concentration to watch your videos, sometimes you copy and paste too fast. However, this is still a great video! p/s: I code follow you in my own file
I have been working with ByteTrack for a bit now, but I have struggled on evaluating its tracking performance do you know if it is possible to check tracking performance of the individual objects using something live MOT metrics?
your code comes with the error of numpy between float, int and double
I recommend using updated version of the notebook: colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-track-and-count-vehicles-with-yolov8-and-supervison.ipynb
thanks
@@Roboflow
@@Roboflow Does that notebook solve the error? Thank you!
Is there any other updated notebook because this one is also throwing some error
@@mariacaleropereira2967 The notebook works perfectly :)
26 minutes for this is not long at all. Thank you for what you do and please don't hesitate to make longer videos, however you see fit.
My pleasure!
It goes to show how streamlined this stuff has become. Try doing a PhD in this ten years ago and having to write your own code for everything AND the novel parts you're working on. Takes months and hours to explain. Now anyone can git clone and run complex models. What a world :)
@@katanshin Truly!
The best and complete tutorial for implementing YOLOV8 based object detection, tracking and counting system. Love it brother
That’s what I strived for! Great to hear you liked it so much 🔥
How can I count the bounding boxes for a set of images ( not a video) in this case ( using a pre trained yolov8 model with only 1 class)
@@ashishreddy2634 Are you trying to detect specific class?
Bro you deserve OSKAR .
Fun Fact: Tqdm is an arabic word pronounced "Ta-qa-dom", which means progress
Hi it's Peter from the video! Wow! I didn't know that. Now you made me look and here is what I found: tqdm derives from the Arabic word taqaddum (تقدّم) which can mean “progress,” and is an abbreviation for “I love you so much” in Spanish (te quiero demasiado).
@@SkalskiP didn't know about the Spanish abbreviation,
Nice informative tutorial btw
This is, in fact, fun. Thank you.
Difficult to install though no module ultralytics🙄
TY for your great work on supervision library. I have modified your line counting algorithm. During counting people from indoor cctv camera, lines stay short to meet counting conditions. Firstly, I tried center dot instead of corners of bb, but it become unstable, especially when a person pass from door, because center of rectangle become unstable while object slowly disappear. Finally, I draw a square at center of object. It fits my case and generate stable countings.
Thank you so much.. I have Zero experience on this matter but following each of your instruction and I did finish my project with my own video.. Super!
Did you do it locally?
Hello Piotr @roboflow, thank you for the video. I have trained my model on 3 different classes.Would it be possible to have the line zone annotator display the count of each class separately rather than the sum of detections of all classes? Can you please help with this?
Always best contexts with very clear explanations... You are perfect bro !
haha! cv bro!
You deserve more subscribers and likes ! Cool guy and straightforward 💛
I hope we will get 50k subs this year! 🤞🏻
@@Roboflow Guys show your love for this dedicated Gentleman by subscribing and liking his content.
Fantastic tutorial, playing around with plenty of the options here, thanks for the upload.
Hi it is Peter from the video 👋Thanks a lot! Let us know what other feature could be useful ;)
Classical... What a topic.. thanks..
No. Thank you for watching! ;)
@@SkalskiP As always amazing job! One problem I am facing inside match_detections_with_tracks function, when the object is not in frame and model return emtpy list this line gives error iou = box_iou_batch(tracks_boxes, detection_boxes)
How can I solve it?
@@shukkkursabzaliev1730 oh, that code is far from being bullet proof. Would you like me to update notebook to work for those use-cases?
Thankyou so much. The explanation was in-depth.
My pleasure!
@@Roboflow by adjusting some resolution and having perfect line counter position,your code is doing great in real-time. 👍
Thank you brothers, for your work!
really good staff!!!
How about showing an example of how we can measure dimensions of objects ? Probably needs to use a reference object of known dimensions ?
Hi! This is Piotr from the video. This is something that is on my mind for a long time. And yes, having some reference object at least to calibrate measurements would be mandatory.
Excellent video 👌
Thanks a lot! 🙏🏻 make sure to try Supervision!
Just wow!
Thank you for this great content.
thank you, nicley done, I was wondering if we use the segmentation model, how can we annotate the segments with supervision ?
Great question. We have support for segmentation on our road map, but it will take us a bit more time to put it on production.
thank you for the video,
however i ran into error when running the code for bytetrack regarding 'loguro' and no matter what i cant solve it
Did you used latest version of our notebook? colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-track-and-count-vehicles-with-yolov8-and-supervison.ipynb
I really need help for one thing.
How can you show the specific number of cars and trucks that have gone in and out.
For example:
3 cars and 1 truck in and
5 cars and 1 truck out
We don't have a dedicated feature yet, but you can build a workaround solution. Create two separate line counters. Filter detections by class, to get car and truck detections and trigger one line counter with car detections and the other with truck detections.
@@Roboflow I will try that, thank you very much!!!
Piotr jest super-duper ultra yolo guru :D
It's Peter from video. I'm not sure if I'm YOLO guru, but thanks a lot for this kind comment. I went through a bit of internet hate lately, so it is great to here some positive feedback.
Great video tutorial. Thank you!!!
Thanks a lot 💜
Thank you for the amazing video! Is it possible to invoke yolo8 on every 4th frame (for example), instead of every single frame? And have some kind of other system follow the object in the other 3 frames (to save on resources).
Not to my knowledge. You skip the frame completely or not. All of those trackers depend on boxes being generated by the model. That being said you can try to pass detections to tracker every 4th frame. It all depends on input video but could still work.
Thank you ,Could you please explain how to count objects detected in images?
nice and simple explanation. i am a beginner and i am trying to start with something simpler like object detection and counting i a picture how would i go about this?
I think this video will be much more useful for you: ruclips.net/video/l_kf9CfZ_8M/видео.html
Nice job ! love from china❤
Hi, it is Peter from the video! Thanks a looot! Love from Poland.
Great video! However I tried implementing it with more than one counter (one for each lane) but it seems that LineCounter is a global variable shared across all other lanes. is there a way to overcome this?
Thank you!
Bro I'm getting problem whenever I'm installation supervision in g-drive
Please let me know how to solve this problem
Great video, thanks a lot
My pleasure!
appreciate the elaborate explanation. Can we tag each of those objects with unique id? like car1, car2 ...etc
thank you
very helpful
That's what I wanted to hear!
Thank you for this tutorial, it helps us a lot
This is great to hear! 💜 I was hoping for such a positive feedback
Hello!
I have a question, how does the model interpret the "out" variable in the candy example? Can it make the difference between if the object is moving to the right or left? Because of how the bounding box is approaching the line?
And thank you so much for creating this content!
Hello Piotr @roboflow , I'm so very thankful for this insightful video i just wanted to know how do you consider the coordinates for the custom dataset like is there a method or just intiution
Not really sure what you mean. Could you elaborate on your question?
@@Roboflow What I meant is you draw out polygons for the polygon zone or line zone. How do you do that like the exact numbers in the numpy array.. You also showed a project for candy counting and tracking on conveyor belt. I couldnt find your video so i found similar in youtube made a dataset trained it but after that i couldn't make coordinates for the "line" based on which if the candy crosses the line its in and count increases.. So basically to sum it up How do one calculate the numpy array for the polygon zone?
Hola tengo el error en la parte del código : tracks = byte_tracker.update( output_results=detections2boxes(detections=detections), img_info=frame.shape, img_size=frame.shape ) ;sale este error: AttributeError: module 'numpy' has no attribute 'float' ;pueden ayudar porfavor
Tengo el mismo error, pudiste solucionarlo?
@@manuelnavarrete4509 si ..antes de ejecutar el código agrega esta línea : !pip install -U numpy==1.23.5 ;después te pedirá reiniciar la sesión ,vuelves a ejecutar el código ya sin volver a instalar el numpy y listo
Great video! How do I customize the counter? For example, position it in the corner of the screen, count cars, trucks, and motorcycles with their own counters? Thank you!
did you find a fix?
Thank you very much, really appreciate! I applied to my custom video, it does not count correctly. I saw in your video it also does not count correctly, how we can improve it?
Could you please do a tutorial about using yolo v8 real time on a webcam, even the pc webcam
Hi! Could you please add that idea here: github.com/roboflow/notebooks/discussions/categories/video-ideas?
YOLOv8 detection + tracking + counting on webcam?
@@neeraj.kumar.1 hi I'll think about it. Next video comming soon :)
fantastic!! Would really like to know if this will work for live rtsp url (multiple different camera's) in real-time
We would need to try out, but I think it will :)
@@Roboflow let us know if you guys try it out. Enjoying the videos
@@anadianBaconator maybe we will manage to include it in one of our upcoming videos
@@Roboflow really appreciate it
Thank you so much for the video. what's the difference between this notebook and using "yolo track model=path/to/best.pt tracker="bytetrack.yaml"" ?
Hi! That video was actually recorded before YOLOv8 team added tracking capability. But in short, you can use ByteTrack with any object detection model, and if you will use Ultralytics implementation then you are bound to use only YOLOv8.
Awesome awesome awesome! Thank you for the excellent work
Is there any easy way to count objects on pre predicted images? And print results in termina. I have a problem with find solution in internet.
Thank you for the video. It's really helpful. Is there any way to detect time stamp in the video to capture at what time Vehicle crosses the count line. It will be a great help.
Thanks a lot. Is that static file or stream?
@@Roboflow Thank you for your reply. Stream. Recorded footage of traffic with timestamp in it when it is recorded. It's similar to the Video used in your explanation.
I really enjoyed the last episodes, very well and comprehensibly explained! Thanks!
Would it be possible to make a video about rotated object detection in YOLOv8? Would be very useful.
Hi, it is Peter from video! Thanks from kind words. It means a lot to me. Is YOLOv8 capable of rotated object detection?
@@SkalskiP Hm you are probably right, rotated detection doesn't exist yet.
Thought I just overlooked it..
Thanks for the answer!
@@SkiLLFace360 no worries it is kind of my job to know it ;)
Thanks. Can you tell me which tracking algorithm works better - ByteTrack or DeepSort
Hi it's Peter from the video. I like ByteTrack a lot more.
Great one! very thorough well explained
Thanks a lot!
Thanks for the video, it has been quite useful! I want to export the Tracking data as a CSV file. Specifically, I want to run the MOT evaluation toolset in order to evaluate my own dataset. Thus, I was wondering how I could correctly export each objects detection, its bounding boxes, confidence and so on for each frame. Any help would be greatly appreciated :))
We will actually release a new video this week. It will be about detections time analysts. But in this video we will show you how to save detections as csv. Stay tuned.
Thank you very much) You guys are really being helpful with your videos.@@Roboflow
Any news on the new video so far? I am really struggling to make sense of analyzing the ByteTrack on the MOT toolset. The codebase that ByteTrack provides is just so faulty and has zero guidance@@Roboflow
Great work helps in understanding topics better. I have one question can I use the same code for image dataset.
Thanks a lot 🙏🏻 Could you explain a bit more?
@@Roboflow I am working on Water Pollution Detection Project and I have a dataset of images of different types of pollution, my goal of this project is that I need to train Yolov8 model on that dataset and model should be able to classify the type of pollution.
@@heetshah5718 YOLOv8 have support for classification but it is most likely not the best model you could use.
@@Roboflow Can you suggest which models should I use and Can I use this same code for image dataset as well?
For classification into car, bus, truck and motorcycle which one is used ByteTrack or Supervision?
Additionally, is Bytetrack also used for counting along with tracking? Because supervision is used for annotations.
Brother, I watched your Object detection for a custom dataset video, it's awesome. I trained with my own dataset and it works like magic. Now, if I want to calculate the time , an object appears in a video, how can I do that? Then, is it possible to do the same for different objects and plot them as graph with Time in y-axis and the type of object in x-axis?
Hi. Thanks a lot. We are actually thinking about making video like that. I hope we will be able to record it soon.
@@Roboflow 😍 Thanks brother! Waiting for that video... ⏳
How can I count cars with two diagonal lines not horizontal lines?? please teach my how to do this
You just need to create two lines and change coordinates of start and end :)
Thank you for the video! What is the specs of your computer? I want to calculate how long it would take to execute this computer vision method on a jetson Nano
I was doing this experiment on google colab. You are pretty much bound to performance of YOLOv8 on Nano. With small model it should be close to real time.
Excellent! Just something I was looking! Thanks Roboflow.
What was the fps?
We hope you will build something cool using supervision pip package ;)
The information is very simple and explained very clearly. Can you please provide the colab link of Candy detection.
Thanks a lot! It is exactly the same Colab. Only difference is difference model and different video. Code wise it is the same.
our project is to detect and count the object on the captured photo. can we follow this tutorial? or is there other more applicable tutorial we can follow
Thank you very much for this useful video, Quick question: can we draw multiple lines for counting in and out traffic over an intersection ?
Yes! You can have multiple lines counting moving objects in different areas of the frame ;)
Also i want to ask if it is possible to export vehicles tracks ( position on each frame) on a separate excel/ csv file
@@LubnaObaid yes it is possible to di it in python, but we do not have any tutorial showing how to do it.
@@Roboflow Is there any specific library or command that you recommend to look for?
@@LubnaObaid last time when I did that I used a regular Python CSV package
Does the same code works for crowd videos ? I’ve been failing to do it.
Thanks.
It should. But I’d need to see specific result to understand what’s failing.
Great video, i have a question in this video the linecounter from supervision will increase when all line from prediction box is through the line. Can you change it so just from bottom line / top line??
Ask this question here: github.com/roboflow/supervision Describe what you want to do. We will do our best to help you.
so useful, thanks a lot
Thank you for this video, it's very explanatory. However, the supervision library has been updated, so these codes don't work anymore. I tried to get all those supervision utils from the documentation with little success after a couple of hours. Could you please , make a video dedicated to supervision library alone and where to find those functions and classes and what each one is used for. That will be very helpful. Thank you once again.
Take a look here: github.com/roboflow/notebooks/pull/190 it is a PR that updates our vehicle counting notebook to supervision 0.13.0.
How to write down the results of each counting on Excel?
this is awesome!
What camera did you use to see the chocolates going?
This is stock footage I downloaded from internet :)
Thanks for your interesting video. Could you make a video to compare YOLOv8, YOLOv7, YOLOv6 for object detection and object tracking? That would be great!!!
Interesting idea! Do you think it is worth comparing them they are all super close regarding accuracy and speed. What sort of benchmark are you mostly interested in?
I want to use supervision for face detection and tracking with Detectron2 model
Great video as always. But the ByteTRACK installation cell is throwing some error. It is unable to install YOLOX. Can anyone please help me debug it.
I uploaded an updated version of that notebook this morning. Should work now :)
thanks for the video. I noticed that even with a clear view of all the vehicles, you still lose track of the truck and it gets a new id. Is there a way to limit the number of ids that the objects get so that this doesnt happen? for example you only have 4 possible labels during the video and the algorithm has to select the most likely label when tracking.
Is is possible to solve those issues. Or to at least make them less frequent. But potential solutions are usually strictly tied to use-case that you are trying to solve. In our case you can notice that those id changes are happening only when cars are still far away or when they are partially ocluded by this large metal object hanging over the left lane. Thats why I would propose to discard objects that are in top half of image and only take into account those that are in bottom half - closer.
I have one question: Since we are trying to count the objects and since the Object's id given by the tracker are unique, why can't we just count the last Id or count the different number of ids?
How do you know how many of them traveled up and how many down?
it is possible to perform object tracking using YOLOv8 with a focus on two specific objects out of the 10 that the model detects. The code can be modified to track only those two predefined objects, providing you with the ability to monitor their movements and positions across frames. If you could provide additional details about the two objects you wish to track, I can assist you in adapting the code accordingly.
hi! thanks ! its v useful. Can it be applied on cellphones ? like an android or IOS app?
@Roboflow may I know why I can't download or play the video? manage to full the code without error sv version 0.18.0
Hi you mean you can’t download video form Colab? Could you be a bit more specific?
Thank you for the good video. How can I get detection to come out in Korean.
How do I get the specific time stamp for which the object was early detected in the video
We don’t have time analysis support yet in supervision :/
I have followed the code provided and the program runs well as shown in the video. If I want to count vehicles according to each class, such as the number of motorbikes and the number of cars. How and which parts should I change in the code? Thank you
super nice video, but probably an update would be amazing since a lot has changed in the repository, right?
Thank you. This is nice. I have a requirement to create vehicle detection model with good accuracy. Is it possible to create for me and work for this
thank you for the tutorial, very easy to understand! I have a question, how do I get the CSV file result to find out the coordinates of the bounding box?
I'd like to use computer-vision + AI, to inspect Printed-Circuit-Boards.. is the best approach one that trains the model on good and bad examples?
Any thoughts on open source approaches, like PCB-Defect-Detection (YOLOv5, RNCC, etc), PCB-Inspection-OpenCV, versus enterprise tools (KollerFacts Inspection, Intuitive Machines Defect Detection, SVI Defect Analyzer, Cyient Inspection, Mentor Tessent YieldInsight).
Could you tell me more about the potential faults that may occur?
@@Roboflow Sometimes the component is not perfectly square on the pads.. or even lifted like a tombstone. Other times the defect is a bit harder to spot, like cold solder, or too much solder that there's a short between pins!
amazing, I learned so much and it help me aswell! do you know if it is possible to use detections from detectron2 instead of yolov8?
Hi it Peter from video 👋Tomorrow we will release second video, showing new Supervision features. I have Detectron2 example for you.
@@SkalskiP Really looking forward to it! Your content is amazing!
@@Jkfyr99 I'm recording right now ;)
Very Nice explanation bro, is there any possibility to colaborate in supervision development?
Dear friend, Thank you for presenting that great stuff. Is there a way to count the separate types of vehicles crossing the line? Unfortunately, I am not able to handle that, even after creating a separately updated line_counter for each vehicle type inside the for loop. I appreciate any help you can provide.
Hi, could you create a discussion thread here: github.com/roboflow/notebooks/discussions I have a lot of work, but I'll try to help you out.
@@Roboflow Thank you for suggesting that - nevertheless, I figured it out. Everything works well after adding the following code for each class I want to detect:
## Recognition of class 2 (cars)
detections = Detections(
xyxy=results[0].boxes.xyxy.cpu().numpy(),
confidence=results[0].boxes.conf.cpu().numpy(),
class_id=results[0].boxes.cls.cpu().numpy().astype(int)
)
# Masking of undesired classes
mask = np.array([class_id in CLASS_ID for class_id in detections.class_id], dtype=bool)
detections.filter(mask=mask, inplace=True)
#Tracking of Objects
tracks = byte_tracker.update(
output_results=ostrukt(detections=detections),
img_info=frame.shape,
img_size=frame.shape
)
tracker_id = match_detections_with_tracks(detections=detections, tracks=tracks)
detections.tracker_id = np.array(tracker_id)
# Extraction of not tracked but recognised objects
mask = np.array([tracker_id is not None for tracker_id in detections.tracker_id], dtype=bool)
detections.filter(mask=mask, inplace=True)
# Labeling of object characteristics
labels = [
f"#{tracker_id} {oklassen[class_id]} {confidence:0.2f}"
for _, confidence, class_id, tracker_id
in detections
]
# Increasement
mask = np.array([class_id in [2] for class_id in detections.class_id], dtype=bool)
detections.filter(mask=mask, inplace=True)
line_counter_car.update(detections=detections)
Good video. Can you help me, what I can add my custom objects in pre-train dataset?
You would need to train your own custom model to add new classes.
Sorry. I didn't express myself correctly. Can I add my classes to the pre-trained weights. For example, I have my own class Y, and I want the model to recognize both classes with coco dataset and class Y.
@@zaskilovan it is possible but would require retraining model too.
Hi I have question in this case you don't use deepsort technique for tracking the cars do I?
I use BytetTack. DeepSort is just another tracker that you can use.
@SkalskiP As always amazing job! One problem I am facing inside *match_detections_with_tracks* function, when the object is not in frame and model return _emtpy list_ this line gives error *iou = box_iou_batch(tracks_boxes, detection_boxes)*
How can I solve it?
Hi it's Peter from the video. I just fixed that problem. Could you try the tutorial once again?
what to do if i want to show the vehicle counts based on their class. like car in: 1, bus in: 2, car out : 5, bus out: 6
Suuperb... What if I want to detect and track the faulty chocolates in that video and mark the chocolate faulty until it leaves out the frame? Any thoughts on this?
Do you have a model to detect those faults?
@@Roboflow No, currently I have a model to detect potatoes on a conveyer belt. For detecting defects I'm thinking of using OpenCV to detect color deviations.
My problem is since potatoes keep rotating on the conveyer belt, I want to track the defective potato even if it keeps rolling.
Hey Peter!
Any thoughts on this? And also, Just now saw your video on Grounding DINO it looks interesting. What are your thoughts on using it to detect rotten/spoiled potatoes as explained in earlier comments.
@@snehitvaddi sorry I missed your comment. If you have images of rotten potatoes you can try if DINO detect it. Sounds like something that should work. Color range is doable as well, just pretty hard to get right color ranges I think :/
Thank you for a very good explanation.
I found that YOLOv8 has their own tracking command both CLI and python mode.
I tried on CLI mode, it works well. but unfortunatly in python mode, ID always reset to id 1.
Now I am thinking of using ByteTrack as you did or do you have any idea of using straight forward way to use YOLOv8 to tracking object.
Thanks,
Nott
Yeah we have video on YOLOv8 native tracking. Take a look here: ruclips.net/video/Mi9iHFd0_Bo/видео.html
@@Roboflow thank you
Thanks! I'm still a beginner, so this is very confusing. So I have one question: I can't use 'best.pt', the model trained with yolov7, in this tutorial, right?
How to check its performance because we always need accuracy, precision and other metrices to find the performance of the model ?, Do I need to annotate first then calculate the accuracy?
How do we count for each class
Thanks for information. By the way, I could not understand about the BYTETracks classes.
In particular, I've tried adjusting the parameters aspect_ratio_thresh and min_box_area, but there wasn't a significant change. I would appreciate it if you could explain the specific meanings of these parameters. I hope to receive a prompt response. Thank you!
Hey there, thanks for the amazing YOLO 8 videos, I run the code for object detection and it was work fine. then I tried to run for instance segmentation. all steps are fine but in the final step when I run the code for Inference with Custom Model, code run without any issue but this message did not appear: Results saved to runs/segment/predict2. do you know what is the problem?
Could you create issue here: github.com/roboflow/notebooks/issues ?
@@Roboflow Hi I found the error , in the code should write : save=true but you forgot it I guess . Thanks
@@lofihavensongs thanks a lot! Let me try to update that
I need 101% concentration to watch your videos, sometimes you copy and paste too fast. However, this is still a great video!
p/s: I code follow you in my own file
Tengo problemas con numpy en la parte del tqdm, y ya cambie los np.float por float y aun asi el problema persiste
GOAT
🐐
I have been working with ByteTrack for a bit now, but I have struggled on evaluating its tracking performance do you know if it is possible to check tracking performance of the individual objects using something live MOT metrics?
Yes, it is possible but you would need to have annotated data.
Could you help with what each of the ByteTrackerArgs are for? I mean track_thresh, track_buffer and so on
Can you please tell me how to calculate the overall accuracy(SHOWING mAP score) of the particular trained yolov7 model in Google colab?
show_frame_in_notebook is not working in google colab so i am unable to see the frame
Could you create issue here: github.com/roboflow/notebooks ? I will try to fix that as soon as possible.