sergio11 / vehicle_detection_tracker

🚗 VehicleDetectionTracker: Real-time vehicle detection and tracking powered by YOLO. 🚙🚕 Enhance your computer vision projects with speed, precision, and adaptability.
https://pypi.org/project/VehicleDetectionTracker/
MIT License
52 stars 12 forks source link

Python 3.10 : TypeError #1

Open aminalaghband opened 3 months ago

aminalaghband commented 3 months ago

/workspace/vehicle_detection_tracker/examples/OpenCvTrackerTest.py", line 19, in

vehicle_detection.process_video(video_path, result_callback = result_callback)

File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/VehicleDetectionTracker/VehicleDetectionTracker.py", line 291, in process_video

response = self.process_frame(frame, timestamp)

File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/VehicleDetectionTracker/VehicleDetectionTracker.py", line 195, in process_frame

delta_t = int(t2) - int(t1)

TypeError: int() argument must be a string, a bytes-like object or a real number, not 'datetime.datetime'

we need to change the package code, delta_t = t2.timestamp() - t1.timestamp()

sergio11 commented 3 months ago

Hi @cryptoer-satoshi,

Thanks for reporting this issue. It seems that the error is related to converting datetime objects to integers in the VehicleDetectionTracker.py file.

To assist you better, could you please provide examples of the data you're working with when this error occurs? This will help us understand the context in which it's happening and how we can address it more effectively.

Looking forward to your response so we can continue working on a solution.

Thank you!

aminalaghband commented 3 months ago

Hi sergio11

I was working with mp4 file which was the input, so I get this error : TypeError: int() argument must be a string, a bytes-like object or a real number, not 'datetime.datetime' then I tried to change package line from: delta_t = int(t2) - int(t1) to this : delta_t = t2.timestamp() - t1.timestamp() so, it works well,

by the way, thank you for great work.

wimdecorte commented 1 month ago

Same issue for me:

File "/Users/wdecorte/Documents/GitHub/vehicle-detection-fastapi/.venv/lib/python3.9/site-packages/VehicleDetectionTracker/VehicleDetectionTracker.py", line 195, in process_frame delta_t = int(t2) - int(t1) TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime' INFO: Shutting down

I was processing an mp4 file locally.

sergio11 commented 1 month ago

Hi @wimdecorte

Could you test with the last version 0.0.32? This issue is already fixed in this version which I just launched

wimdecorte commented 1 month ago

Hi @sergio11 ,

That was using 0.0.32. Changing line 195 fixes the issue as per @cryptoer-satoshi 👍

image