kcg2015 / vehicle-detection-and-tracking Goto Github PK
View Code? Open in Web Editor NEWComputer vision based vehicle detection and tracking using Tensorflow Object Detection API and Kalman-filtering
Computer vision based vehicle detection and tracking using Tensorflow Object Detection API and Kalman-filtering
Hello,
Thanks for your project, it's amazing.
I'm planning to use infrared (thermal) camera instead of RGB camera. What changes needs to be considered ?
the tacker is not tracking the sequence of images in "test_mages" folder.
the position of the bounding boxes do not change. it well track the "frame003" image
Hello,
Thank you for this amazing tutorial! I really appreciate it! I was trying to execute your code with videos and I'm getting this particular error
In line 43 of main.py
in assign_detections_to_trackers
IOU_mat[t,d] = box_iou2(trk,det)
NameError: name 'box_iou2' is not defined
Traceback (most recent call last):
File "E:/PycharmProject/Vehicle-Detection-and-Tracking/main.py", line 201, in
image_box = pipeline(image)
File "E:/PycharmProject/Vehicle-Detection-and-Tracking/main.py", line 115, in pipeline
= assign_detections_to_trackers(x_box, z_box, iou_thrd=0.3)
File "E:/PycharmProject/Vehicle-Detection-and-Tracking/main.py", line 71, in assign_detections_to_trackers
if IOU_mat[m[0], m[1]] < iou_thrd:
IndexError: index 0 is out of bounds for axis 0 with size 0
matched_idx:(array([], dtype=int32), array([], dtype=int64)),shape:(2, 0)
matched_idx:(array([], dtype=int32), array([], dtype=int64)),shape:(2, 0)
#########################
Can you tell me how to solve it? Thank you?
Hi Sir,
Thank you for your great work.
I'm curious about how you set the initial value of each covariance ?
Any design consideration or if it's only random values?
Thank you in advance.
Best Regards,
Lai
Hi Kyle,
First of all I would like to thank you as I am grateful for your amazing work, I am a student conducting a research for my thesis on people counter using object detection and tracking and this was very helpful.
I used the SSD mobilenet pre-trained model and trained with a custom dataset I made from overhead images of people taken from an IP camera. I was able to detect the heads of people using tensorflow's object detection API after training while in real-time. With the help of your code and some arrangements to it I was also able to track the people's movement and assign an ID.
My next step, and this is where I am struggling, is to count the person entering a room i.e after crossing the ROI(region of interest) so it is important I know the direction of the movement (up or down) and when it crosses this ROI. I have spent a lot of time searching for something similar that could be useful to me but no luck. I was wondering if you had any feedback that could be of help to me as it would be greatly appreciated. TIA.
Below is a sample image of my work.
hi, I don't know why I got this wrong message?
$ python main.py
Traceback (most recent call last):
File "main.py", line 193, in
det = CarDetector()
NameError: name 'CarDetector' is not defined
I think you should add "self.car_boxes = []" after "print('no detection!')" in file"detector.py" 124 line.
Otherwise it will keep showing the last position of previous object until the detector detects a new object.
I am trying to assign id to the tracked object but nothing is giving me an output , can any please give some idea about this, and can you please tell me about the tracker's id defined in tracker.py
Hi @kcg2015,
Thanks for your great work.
I have a question on function Deal with matched detections
in main.py
.
Assume in the 1st frame, there is no matched detections, then we will jump to if len(unmatched_dets) > 0:
. It does the tmp_trk.predict_only()
by using current detection (x = np.array([[z[0], 0, z[1], 0, z[2], 0, z[3], 0]]).T; tmp_trk.x_state = x
).
In the 2nd frame, I assume that all objects in 1st frame are matched to detections in 2nd frame, then we jump to if matched.size > 0
, and do predict. However, in tmp_trk.kalman_filter(z)
, I saw that the code does predict then update with current detection info. I am confused because we already did predict when processing detection in the 1st frame?
Can you clarify my confusion?
I suppose that we should do update and then predict.
Thank you so much.
Traceback (most recent call last):
File "/usr/lib/python3.6/code.py", line 91, in runcode
exec(code, self.locals)
File "", line 1, in
File "/snap/pycharm-professional/132/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/tejanmehndiratta15/.local/lib/python3.6/site-packages/moviepy/editor.py", line 33, in
from .video.io.VideoFileClip import VideoFileClip
File "/snap/pycharm-professional/132/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/tejanmehndiratta15/.local/lib/python3.6/site-packages/moviepy/video/io/VideoFileClip.py", line 3, in
from moviepy.video.VideoClip import VideoClip
File "/snap/pycharm-professional/132/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "main.py", line 140, in pipeline
tmp_trk = Tracker() # Create a new tracker
NameError: name 'Tracker' is not defined
I just ran your code as it is, but there is an error in the main.
AttributeError Traceback (most recent call last)
in
198 for i in range(len(images))[0:7]:
199 image = images[i]
--> 200 image_box = pipeline(image)
201 plt.imshow(image_box)
202 plt.show()
in pipeline(img)
100 if debug:
101 for i in range(len(z_box)):
--> 102 img1= helpers.draw_box_label(img, z_box[i], box_color=(255, 0, 0))
103 plt.imshow(img1)
104 plt.show()
AttributeError: module 'helpers' has no attribute 'draw_box_label'
Hi!
when i run the main.py, it happended to be a problem called ''NameError: name 'Tracker' is not defined" and "2.82it/s]wrong ratio or wrong size, [426 230 441 257] , confidence: 0.36141032 ratio: 0.5553498704183636". I don't know the cause. Please you help me!
Thank you!
Can you share the code for training the model using my own dataset
thank yo u
I can't find the 'vis_util' in the file detector.py
.
Dear, Mr Kcg2015, How are you?
Your project is very helpful and explanation is very detail so thanks for your efforts for developing this project.
By the way, Did you have experiences in vehicle logo detection with YOLO?
I am new about training with YOLO so that I wanna receive your kindly help.
Thanks and Regards, RIchardMinh.
Hello, this is an error when I run tracker.py.
File "tracker.py", line 58, in init
self.R_diag_array = self.R_ratio * np.array
AttributeError: 'Tracker' object has no attribute 'R_ratio'
So, I want to know, where is 'R_ratio' defined?
Thank you!
I am curious to know that will kalman tracker work when no object is detected in the frame.I saw few ropo(https://github.com/abewley/sort) required detection in every frame otherwise it will leave track on object(car in this case).
So will kalman predict function will give next location even when no detection is received from detector.
Thanks in advance.
Is there supposed to be a folder named 'models' because I'm getting an error for it.
Dear, Mr Kcg2015, How are you?
Your project is very helpful and explanation is very detail so thanks for your efforts for developing this project.
When I run main.py to test my own video, there is something wrong.(video information as follows, test file size about 1.5GB)
When the first frame is detected, the program terminates. The results and errors of the first frame detection are as follows:
I would like to ask why there is such a mistake, thank you for your solution.
Best.
Hello,
I changed the v to 1 but it doesn't detect persons
Whether an operation tmp_trk.no_losses = 0
should be performed after the operation tmp_trk.hits += 1
?
Hello,
The tracking is lost and it's not accurate, sometimes in the cars the bounding box is hidden for few frames then it continues tracking again
Hello,
How would I draw the path of the cars that are moving ?
Thanks so much
hi helper ... can I take the principle you used for matching detection and trackers and use dlib for creating a new tracker for the unmatched detection?
Kindly provide requirements.txt file.
Dear Author(kcg2015),
your work is amazing and also great in sharing your work to research community.
Here you are considering the constant velocity model in the process matrix, as shown in snapshot:
Here Im having few queries mentioned below:
Iam able to track the object when I capture frames at 30FPS but unable to track the objects when frames are captured at 10FPS as my position is changing vsatly, so how to deal when frame rate is less around 10FPS?
Thanks for your valuable time, I eagery look forward for your response.
Thanks,
Anil.
Hey,
thank you for this awesome work! However I couldn't find any license information? Is it MIT- or BSD-licensed ?
Traceback (most recent call last):
File "main.py", line 200, in
image_box = pipeline(image)
File "main.py", line 112, in pipeline
= assign_detections_to_trackers(x_box, z_box, iou_thrd = 0.3)
File "main.py", line 56, in assign_detections_to_trackers
if (d not in matched_idx[ : ,1]):
TypeError: tuple indices must be integers or slices, not tuple
Hi,
First of all, thanks for sharing this great work!
I am using this on other videos of people walking and I figured the following code needs to change a bit to accommodate bigger detections/bounding boxes in addition to changing the ID to 1 (person) instead of 3 (car)
in detector.py
I changed # if ((ratio < 0.8) and (box_h>10)):
to be if ((ratio < 2) and (box_h>20) and (box_w>20)):
but I am still not seeing tracker properly working on this by following the detected object along like in your sample video
wondering what's going on?
Hi, thanks for your amazing project, i have a question about video tracking, how can i see the different ID for car in the final output video?
For low frame rate the tracker is lagging, is there a way i can make it work for low frame videos.
Like for example changing the dt value in tracker.py
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.