-
(Optional) Install CUDA to enable inference with gpu (nvidia gpu only)
-
Conda environment
-
Install Miniconda
-
Launch the miniconda terminal and setup an environment (in Windows should be a new app called "Anaconda Prompt (miniconda3)"):
conda create -n traffic_count python=3.8 -y-
"traffic_count" will be the name of the environment, feel free to change it, just remember to use the same name later in steps 2.1 and 3.1.
-
You can check if you already have a working environment with the following command:
conda info --envs
-
-
"python=3.8" means that we will be using version 3.8 in our python environment. The project should work with versions 3.7 and 3.8, any higher than that might require some fixes on the code to keep it up to date.
-
-
-
Repositories setup
-
Activate the environment made in step 1 using the miniconda terminal:
conda activate traffic_count -
Install git:
-
Option 1: Install Git for your operating system (restart your terminal and reactivate your environment after installation using this approach)
-
Option 2: Install git through conda:
conda install -c anaconda git
-
-
Clone repositories:
-
Traffic-count-cctval:
git clone https://github.com/ijorquera/Traffic-Count-CCTVAL -
torchreid:
git clone https://github.com/KaiyangZhou/deep-person-reid.git
-
-
(Jetson-nano) Install Traffic-count-cctval dependencies:
-
Install requirements:
python3.8 -m pip install --no-cache-dir -r Traffic-Count-CCTVAL/requirements.txt -
Install pytorch with support for CUDA 10.2 (highest cuda version available for the Jetson nano)
python3.8 -m pip install torch==1.12.1+cu102 torchvision==0.13.1+cu102 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu102
-
-
(Windows) Install Traffic-count-cctval dependencies:
-
Install requirements:
pip install --no-cache-dir -r Traffic-Count-CCTVAL/requirements.txt -
Install pytorch (check on pytorch for the right command for your system)
-
For latest version with cuda 12.1 support on windows:
pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 -
For latest version with cpu only on windows:
pip install torch torchvision torchaudio
-
-
-
(Linux) Install Traffic-count-cctval dependencies:
pip install --no-cache-dir -r Traffic-Count-CCTVAL/requirements-linux.txt- For linux, just requirements is enough since it will auto-detect wether there is a gpu with cuda support or not
-
Install torchreid:
cd deep-person-reidpython setup.py developcd ..
-
-
Traffic-count-cctval test:
-
Activate the environment made in step 1 using the miniconda terminal:
conda activate traffic_count -
Change directory to the repo with the project:
cd Traffic-Count-CCTVAL -
Test with one of the sample videos (change
pythonforpython3.8on the Jetson nano):python track.py --source heavy.mp4 --save-vid --show-vid --save-txt -
Test with integrated camera:
python track.py --source 0 --save-vid --show-vid --save-txt
-
-
Known errors:
- Error Placeholder
- Media source
$ python track.py --source 0 # webcam
img.jpg # image
vid.mp4 # video
path/ # whole directory
'https://youtu.be/link' # YouTube
'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream
- Yolo Model
$ python track.py --source 0 --yolo_model yolov5n.pt
yolov5s.pt
yolov5m.pt
yolov5l.pt
yolov5x.pt
...
- Image size (pixels)
$ python track.py --source 0 --yolo_model yolov5n.pt --img 640
--img 1280
- How to save output
$ python track.py --source 0 --yolo_model yolov5n.pt --img 640 --save-vid
--show-vid
--save-txt