-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
howto improve the boudingbox around the vehicle ? #124
Comments
Speed camera is an object detection rather than vehicle detection. It
finds the largest moving contours and tracks motion while filtering out
data points that are not close to the previous motion track event or times
out. Eg motion stops before completing the track.
Most often a vehicle will have certain areas that are picked up as a
separate contour. Eg wheel well, truck, door Etc. If the object is far
enough away it can lock onto the whole object depending on the background.
Eg white vehicle with snow background or green vehicle and green
background. It is possible to do AI object detection using AI or haar
cascade method. This takes quite a bit of processing. Speed camera does
not use object detection. It uses only motion detection for tracking.
I have been thinking of doing post processing on speed images to do object
detection
Here are some links fyi
AI deep learning example https://github.com/MaryamBoneh/Vehicle-Detection
Haar Cascade example
https://github.com/andrewssobral/vehicle_detection_haarcascades
Speed camera Object Tracking was written to be a simple real time project
that I wrote for fun and at the time the Raspberry Pi was very limited in
processing power.
It would be possible to write something using deep learning object
recognition if someone would like to take on the project.
Let me know if this answers your question.
Claude ...
…On Wed, Dec 21, 2022 at 5:16 AM sebsoft ***@***.***> wrote:
Hi Claude,
Love your work. I'm trying to use speed-camera to estimate the size of the
passing vehicles into different classes like, car, van and truck.
The picture below shows a vehicle passing the road in front of my house. I
have a perfect 90 degrees view. It seems that the height of the bounding
box is most of the times correct but the length is usually incorrect. I
could estimate the vehicle class using the heigth only but are there any
settings which will get the box around the complete vehicle ?
[image: image]
<https://user-images.githubusercontent.com/5960276/208891067-a0223d1c-bdfa-4f47-a899-46701bd3a9a1.png>
[image: image]
<https://user-images.githubusercontent.com/5960276/208892491-c5efbf88-32ef-41c2-a321-dfe2ca09381f.png>
—
Reply to this email directly, view it on GitHub
<#124>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABNPKZHOKORTM6XDG2IKD2DWOLRKPANCNFSM6AAAAAATFQILGY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
YouTube Channel at https://www.youtube.com/user/pageaucp
<http://www.youtube.com/user/pageaucp>
GitHub Repository at https://github.com/pageauc
|
Hi Claude, Thank you for elaborate answer. Post processing the captured images would indeed be a elegant solution. Let see how far i get with that. Sebastiaan |
Hi Claude I did a post processing test on the desktop with yolo which has a pretrained model with several object classes which includes cars, trucks bikes etc. First results look pretty good. The red box on the picture with id=2 is the result of the object detection. snippet
|
Thanks for the update. If you decide to post code online, a link would be
appreciated.
Claude ...
…On Wed, Feb 1, 2023 at 9:53 AM sebsoft ***@***.***> wrote:
Hi Claude
I did a post processing test on the desktop with yolo which has a
pretrained model with several object classes which includes cars, trucks
bikes etc. First results look pretty good. The red box on the picture with
id=2 is the result of the object detection.
Have to check if it runs on the rpi as well.
snippet
net = cv2.dnn.readNet("models/yolov4.weights", "models/yolov4.cfg")
self.model = cv2.dnn_DetectionModel(net)
self.model.setInputParams(size=(832, 832), scale=1 / 255)
# Allow classes containing Vehicles only
self.classes_allowed = [0,1, 2, 3, 5, 6, 7, 8, 9]
#person
#bicycle
#car
#motorbike
#aeroplane
#bus
#train
#truck
#boat
[image: image]
<https://user-images.githubusercontent.com/5960276/216091503-d7ea4a99-9d32-4e78-9db5-c9dddce32a2c.png>
—
Reply to this email directly, view it on GitHub
<#124 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABNPKZEN2HQT7XAYJHWFF2TWVKBJDANCNFSM6AAAAAATFQILGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
YouTube Channel at https://www.youtube.com/user/pageaucp
<http://www.youtube.com/user/pageaucp>
GitHub Repository at https://github.com/pageauc
|
If I read the code correctly, it saves the last image with its found rectangle. @sebsoft to improve the rectangle, you could keep track of all images for a certain vehicle detection event and save the one with the biggest rectangle. |
See below the result of another approach. The first and last image are saved to disk and together with the timespan between them passed to the code which does the object detection. Below the last image with the object detection box from the first image added. The blue line connects the centers of the the boxes. Using the pixel / m values the length of the object is calculated and from the length of the blue line the speed of the object. |
@Mobilitysensing Thats very nice! Can you share the code changes you did for this? This will help me tweak the parameters a bit better. I still see cars passing by at unrealistic speeds in my setup. |
Wow, that's clever - I like that! Well done. |
You can find the complete code here. ( It needs some polishing as it is much based on trial and error) It works pretty well but depends on lightning conditions. When cars cast shades on the road they can sometimes be classified as other object (boat, plane etc) and the boundingbox includes the shade. |
Hi Claude,
Love your work. I'm trying to use speed-camera to estimate the size of the passing vehicles into different classes like, car, van and truck.
The picture below shows a vehicle passing the road in front of my house. I have a perfect 90 degrees view. It seems that the height of the bounding box is most of the times correct but the length is usually incorrect. I could estimate the vehicle class using the heigth only but are there any settings which will get the box around the complete vehicle ?
The text was updated successfully, but these errors were encountered: