diff --git a/README.md b/README.md index 0b2eebe..1c0706b 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,48 @@ -1. Install necessary libs and drivers -``` -sudo apt install nvidia-driver-535 +**1. Install necessary libs and drivers** -wget https://developer.download.nvidia.com/compute/cudnn/9.2.0/local_installers/cudnn-local-repo-ubuntu2204-9.2.0_1.0-1_amd64.deb -sudo dpkg -i cudnn-local-repo-ubuntu2204-9.2.0_1.0-1_amd64.deb +https://www.python.org/downloads/ + +Windows + * [Install CUDA](https://developer.nvidia.com/cuda-12-1-0-download-archive) + +Linux +* ``` + sudo apt install nvidia-driver-535 + + wget https://developer.download.nvidia.com/compute/cudnn/9.2.0/local_installers/cudnn-local-repo-ubuntu2204-9.2.0_1.0-1_amd64.deb + sudo dpkg -i cudnn-local-repo-ubuntu2204-9.2.0_1.0-1_amd64.deb + + sudo cp /var/cudnn-local-repo-ubuntu2204-9.2.0/cudnn-*-keyring.gpg /usr/share/keyrings/ + sudo apt-get update + sudo apt-get -y install cudnn nvidia-cuda-toolkit -y + nvcc --version + ``` + +**2. Install dependencies** + + * (Optional) Install virtual env: + ``` + pip install virtualenv + python -m venv env + env\Scripts\activate + ``` -sudo cp /var/cudnn-local-repo-ubuntu2204-9.2.0/cudnn-*-keyring.gpg /usr/share/keyrings/ -sudo apt-get update -sudo apt-get -y install cudnn nvidia-cuda-toolkit -y -nvcc --version -``` -2. Install dependencies ``` python -m pip install --upgrade pip pip install --upgrade huggingface_hub pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 - pip install ultralytics albumentations + pip install git+https://github.com/airockchip/ultralytics_yolov8.git + pip install albumentations onnx ``` + +**3. Fix possible problems** +* Windows: + * cv2.error: OpenCV(4.10.0) ...\window.cpp:1301: error: (-2:Unspecified error) + ``` + pip uninstall opencv-python + pip install opencv-python + ``` + * fbgemm.dll error + ``` + copypaste libomp140.x86_64.dll to C:\Windows\System32 + ``` diff --git a/scripts/init-sftp.sh b/scripts/init-sftp.sh index 91dd0c5..41e79de 100644 --- a/scripts/init-sftp.sh +++ b/scripts/init-sftp.sh @@ -3,12 +3,15 @@ apt update apt upgrade apt install -y ssh -groupadd sftp -useradd -g sftp -M -p Azaion1000sftp01 -d /azaion-media -s /bin/false sftpuser +adduser azaionsftp + +mkdir /azaion-media/sftphome +chown -R azaionsftp:azaionsftp /azaion-media/sftphome/ +chmod -R 755 /azaion-media/sftphome/ cat <> /etc/ssh/sshd_config -Match Group sftp - ChrootDirectory /azaion-media +Match Group azaionsftp + ChrootDirectory %h X11Forwarding no ForceCommand internal-sftp AllowTcpForwarding no diff --git a/tests/export-rknn.py b/tests/export-rknn.py new file mode 100644 index 0000000..e57cf6e --- /dev/null +++ b/tests/export-rknn.py @@ -0,0 +1,5 @@ +import onnx +from ultralytics import YOLO + +model = YOLO('azaion-2024-08-13.pt') +model.export(format='rknn') diff --git a/tests/libomp140.x86_64.dll b/tests/libomp140.x86_64.dll new file mode 100644 index 0000000..c12acdc Binary files /dev/null and b/tests/libomp140.x86_64.dll differ diff --git a/test-prediction.py b/tests/test-prediction.py similarity index 81% rename from test-prediction.py rename to tests/test-prediction.py index 1d034ae..025c4c2 100644 --- a/test-prediction.py +++ b/tests/test-prediction.py @@ -4,7 +4,6 @@ from ultralytics import YOLO # from vidgear.gears import CamGear import cv2 from time import sleep -from os import path model = YOLO('azaion-2024-08-13.pt') @@ -16,8 +15,8 @@ fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') input_name = sys.argv[1] output_name = Path(input_name).stem + '_recognised.mp4' -v_input = cv2.VideoCapture(path.join('tests', input_name)) -v_output = cv2.VideoWriter('', fourcc, 20.0, (640, 480)) +v_input = cv2.VideoCapture(input_name) +v_output = cv2.VideoWriter(output_name, fourcc, 20.0, (640, 480)) while v_input.isOpened(): ret, frame = v_input.read() @@ -28,8 +27,8 @@ while v_input.isOpened(): frame_detected = results[0].plot() frame_detected = cv2.resize(frame_detected, (640, 480)) - # cv2.imshow('Video', frame_detected) - # sleep(0.03) + cv2.imshow('Video', frame_detected) + sleep(0.01) v_output.write(frame_detected) if cv2.waitKey(1) & 0xFF == ord('q'): diff --git a/tests/test01.jpg b/tests/test01.jpg deleted file mode 100644 index 099192f..0000000 Binary files a/tests/test01.jpg and /dev/null differ diff --git a/tests/test01.txt b/tests/test01.txt deleted file mode 100644 index feade35..0000000 --- a/tests/test01.txt +++ /dev/null @@ -1 +0,0 @@ -0 0.3809 0.49269 0.21636 0.39129