kaylode / vehicle-counting Goto Github PK
View Code? Open in Web Editor NEWVehicle counting using Pytorch
License: MIT License
Vehicle counting using Pytorch
License: MIT License
@kaylode thanks for great work !
How to run the code with new video that don't have the json file that include annotations as in demo folder, I have multiple videos and I want to use the pretrained model on them
!python run.py --input_path='/content/main/demo/sample/cam_04.mp4' \
--output_path="/content/results" \
--weight="/content/gdrive/MyDrive/best.pt"
as we can see we should have a json file in the same folder (demo/sample) with the video and it must have the same name, what if we want to pass a new video that don't have a json of annotations ?
where is the main file?????
Thanks for a really fun project to play with. I tried to find the description of the vehicle/object type detected (e.g. motorcycle, car, bus, etc.). I noticed that one of your gifs shows those, but I couldn't find the list not get a similar result. I did look quickly at the original training data, but at least at first glance couldn't find it in there either.
Could you point me in the right direction?
(oops was logged in with the wrong account, oh well)
Can't get attribute 'Model' on <module 'models.yolo' from 'E:\Python\vehicle-counting-master\vehicle-counting-master\models\yolo\init.py'>
i run
python run.py --input_path='moos.mp4' --output_path="results" --weight="best.pt"
Hello,
I see that in your folder ./vehicle-counting/configs/cam_configs.yaml. There is a file naming 'aic-hcmc2020/zones/zones_movement_paths/cam_01.json'. But in your link of dataset there is not, just images and annotation. Could you please provide the file json with the zone movement ?
Best regard
why this error happened ?
it happened in some videos. not all videos .
Fusing layers... Model Summary: 308 layers, 21065925 parameters, 0 gradients Adding AutoShape... 76% 219/288 [00:08<00:02, 25.41it/s] Traceback (most recent call last): File "run.py", line 48, in <module> main(args, config) File "run.py", line 30, in main pipeline.run() File "/content/main/modules/__init__.py", line 67, in run track_result = self.tracker.run(ori_img, boxes, labels, scores) File "/content/main/modules/track.py", line 40, in run bbox_xyxy[:, 2] += bbox_xyxy[:, 0] IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
when i use your video demo , it works well
but if i use different video name ,(i also remember to change the .josn file name) , it gives me this error.
(car_video is the video name).
if i rename my video to cam_04 it works .
Fusing layers... Model Summary: 213 layers, 7020913 parameters, 0 gradients Adding AutoShape... Traceback (most recent call last): File "run.py", line 48, in <module> main(args, config) File "run.py", line 30, in main pipeline.run() File "/content/main/modules/__init__.py", line 34, in run self.cam_config.cam[cam_name], KeyError: 'car_video'
I did everything in order, but I got an error.
Do you know what the problem is?
(py38) C:\coding\DeepSORT_YOLOv5_Pytorch-master>python main.py --cam 0 --display
Namespace(agnostic_nms=False, augment=False, cam=0, classes=[0], conf_thres=0.5, config_deepsort='./configs/deep_sort.yaml', device='', display=True, display_height=600, display_width=800, fourcc='mp4v', frame_interval=2, img_size=640, input_path='input_480.mp4', iou_thres=0.5, save_path='output/', save_txt='output/predict/', weights='yolov5/weights/yolov5s.pt')
Initialize DeepSORT & YOLO-V5
Using CPU
Using webcam 0
Traceback (most recent call last):
File "main.py", line 259, in
with VideoTracker(args) as vdo_trk:
File "main.py", line 53, in init
cfg.merge_from_file(args.config_deepsort)
File "C:\coding\DeepSORT_YOLOv5_Pytorch-master\utils_ds\parser.py", line 23, in merge_from_file
self.update(yaml.load(fo.read()))
TypeError: load() missing 1 required positional argument: 'Loader'
[ WARN:0] global D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (438) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback
Hello kaylode!
First, Thank you for sharing your project :) It is a really helpful idea for me!
I customized labels and could get customized yolo v5 weights files(best.pt).
I have tried your code using my custom weights and video but it was failde :(
When I run code without weight value. It works (but it is not result what i expected )
like this (python run.py --input_path="./cam_04.mp4" --output_path="~" )
When I run code with weight value, It shows error :(
(python run.py --input_path="./cam_04.mp4" --output_path="~" --weight="./best.pt")
you mentioned 3 things in "Start inference: Define these things before run"
as I undertood,
Am I right?
I'll wait for your reply. Again Thanks for the good research.
Traceback (most recent call last):
File "C:\AhmedHefnawy\buy\altr\vehicle-counting-master\vehicle-counting-master\run.py", line 48, in
main(args, config)
File "C:\AhmedHefnawy\buy\altr\vehicle-counting-master\vehicle-counting-master\run.py", line 30, in main
pipeline.run()
File "C:\AhmedHefnawy\buy\altr\vehicle-counting-master\vehicle-counting-master\modules_init_.py", line 31, in run
videoloader = VideoLoader(self.config, video_path)
File "C:\AhmedHefnawy\buy\altr\vehicle-counting-master\vehicle-counting-master\modules\datasets.py", line 88, in init
dataset = VideoSet(config, video_path)
File "C:\AhmedHefnawy\buy\altr\vehicle-counting-master\vehicle-counting-master\modules\datasets.py", line 24, in init
self.initialize_stream()
File "C:\AhmedHefnawy\buy\altr\vehicle-counting-master\vehicle-counting-master\modules\datasets.py", line 45, in initialize_stream
assert 0, f"Cannot read video {os.path.basename(self.input_path)}"
AssertionError: Cannot read video cam_04.mp4'
Hi,
I would like to run your program. However, I m unable to download the pre-trained pth files for testing.
Do you still keep the model files? Possible to share the link to download?
Thanks.
Thank you very much for your great work,
i like your work allot ,
please can you detect speed and add it to your repo .
it will make more prefect .
thank you
Hi,
I'm not getting the best performance I was expecting. I am running on windows with an i7 4790k and GTX970 and its not utilizing my cpu or gpu when running the detect.py with -c=2 and batch size of 8. I am running it on a long video but I want to know am I missing something regarding performance or is this just the way it is? It's running incredibly slow with 7s/it.
Hi, your project vehicle-counting(commit id: 5007a54) requires "albumentations==0.5.2" in its dependency. After analyzing the source code, we found that the following versions of albumentations can also be suitable, i.e., albumentations 0.5.0, 0.5.1, since all functions that you directly (6 APIs: albumentations.augmentations.transforms.Resize.init, albumentations.core.composition.Compose.init, albumentations.augmentations.transforms.PadIfNeeded.init, albumentations.core.composition.BboxParams.init, albumentations.augmentations.transforms.Normalize.init, albumentations.augmentations.transforms.LongestMaxSize.init) or indirectly (propagate to 10 albumentations's internal APIs and 0 outsider APIs) used from the package have not been changed in these versions, thus not affecting your usage.
Therefore, we believe that it is quite safe to loose your dependency on albumentations from "albumentations==0.5.2" to "albumentations>=0.5.0,<=0.5.2". This will improve the applicability of vehicle-counting and reduce the possibility of any further dependency conflict with other projects.
May I pull a request to further loosen the dependency on albumentations?
By the way, could you please tell us whether such an automatic tool for dependency analysis may be potentially helpful for maintaining dependencies easier during your development?
(ptrorch) PS C:\Users\Administrator\Downloads\Compressed\vehicle-counting-1-master> python detect.py --video_path input.mp4
Traceback (most recent call last):
File "detect.py", line 123, in
config = Config(os.path.join('configs',args.config))
File "D:\ProgramData\Anaconda3\envs\ptrorch\lib\ntpath.py", line 117, in join
genericpath._check_arg_types('join', path, *paths)
File "D:\ProgramData\Anaconda3\envs\ptrorch\lib\genericpath.py", line 152, in _check_arg_types
raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
(ptrorch) PS C:\Users\Administrator\Downloads\Compressed\vehicle-counting-1-master>
i really love your repo here, it such a great project. i have a quick question for you. before inference process, there's a process to download file like this.
Downloading: "https://github.com/ultralytics/yolov5/archive/master.zip" to /root/.cache/torch/hub/master.zip
is it really mandatory to download the file ? or you can put the file locally ? thank you.
Hi,
would you advise how to convert t7 to pb?
`content/main
Traceback (most recent call last):
File "run.py", line 1, in
from utilities.getter import *
File "/content/main/utilities/init.py", line 1, in
from .getter import *
File "/content/main/utilities/getter.py", line 1, in
from networks import *
File "/content/main/networks/init.py", line 1, in
from .yolo import get_model
File "/content/main/networks/yolo.py", line 6, in
from augmentations import MEAN, STD
File "/content/main/augmentations/init.py", line 1, in
from .transforms import *
File "/content/main/augmentations/transforms.py", line 1, in
import cv2
File "/usr/local/lib/python3.7/dist-packages/cv2/init.py", line 9, in
from .cv2 import _registerMatType
ImportError: cannot import name '_registerMatType' from 'cv2.cv2' (/usr/local/lib/python3.7/dist-packages/cv2/cv2.cpython-37m-x86_64-linux-gnu.so)
`
i got this error when running your colab , and also it didnot work in my pc
Hello
Thank for your excellent work. Can you give us a pretrained weight with HCMC-AIC dataset ? The link that you provide is die. https://drive.google.com/file/d/1urU0JKQqrI-BNtOCwqLSPr-aue1qWN0U/view?usp=sharing
Thank you a lot !
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.