NVIDIA Jetson Nano & Jetson inference – PART4 (CAM&YOLO3)

Base code : https://github.com/jkjung-avt/tensorrt_demos#yolov3
Updated Code : https://github.com/min-sangshik/tensorrt_demos

[sample command]
python3 trt_yolov3.py --model yolov3-608 --usb --vid 0 --width 1280 --height 720

--file --filename test_video.mp4: a video file, e.g. mp4 or ts.
--image --filename test_image.jpg: an image file, e.g. jpg or png.
--usb --vid 0: USB webcam (/dev/video0).
--rtsp --uri rtsp://admin:123456@192.168.1.1/live.sdp: RTSP source, e.g. an IP cam.

[Image File] FPS 1.3
$mikado2@mikado2-desktop:~/github/tensorrt_demos$ python3 trt_yolov3.py –model yolov3-608 –image –filename test_image.jpg

[CAM-TEST-OK]
python3 trt_yolov3.py --model yolov3-608 --vid 1 --width 1280 --height 720
(test OK, 연결 : 0.USB Cam, 1. 라즈베리파이 cam)
[My Own Weight (from darknet) Test]
1. Classes 6 (coco is 80)
so 3 filter 255 -> 33 , Classed 80 -> 6 (in yolov3-416.cfg)
2. Convert yolo 416 (more perference)
.weights -> .onnx -> .trt
3. my own classes names add to
./utils/yolov3_classes.py
4. category_num change
./utils/yolov3.py (line 34)
in my case, caegory is 6
5. my own classes names set
./trt_yolov3.py copy to ./trt_yolov3_deepfamily1.py
line 80 => #cls_dict = get_cls_dict('coco')
cls_dict = get_cls_dict('deepfamily') #deepfamily project
5.Test my own trained weight & CAM ( CSI Interface )
$python3 trt_yolov3_deepfamily1.py --model yolov3-416 --vid 1 --width 1280 --height 720

[기타정보]
CPU 20~40%, MEMORY 84%(실행전 40% 수준, 실행후 84%=3.3G수준)
FPS : 3.4 (YOLOv3 416모델 이용)

[TODO LIST]
1순위
. 사람 Detection 시 음성출력기능 구현

2순위
. 음성합성, 인식 기능 추가
(출력정보는 날씨연동 등)
. 메모리 적게 이용하는 모델 검토 필요
(이유는 BERT등 음성부분을 같이 탑재하기 위함)
. 프로젝트명인 BR에 맞게 토끼에 장치 넣어서 테스트하기

3순위
. 장시간 이용시 메모리 상태 체크하기
. 주기적으로 재시작하는 로직 개발
. 이벤트 발생시 이미지 저장기능

[Etc]
mikado2@mikado2-desktop:~/github/tensorrt_demos$ python3 trt_yolov3.py –model yolov3-608 –image –filename test_image.jpg
Gtk-Message: 00:34:49.800: Failed to load module “canberra-gtk-module”
Traceback (most recent call last):
File “trt_yolov3.py”, line 96, in
main()
File “trt_yolov3.py”, line 88, in main
loop_and_detect(cam, trt_yolov3, conf_th=0.3, vis=vis)
File “trt_yolov3.py”, line 52, in loop_and_detect
if cv2.getWindowProperty(WINDOW_NAME, 0) < 0:
cv2.error: OpenCV(4.1.1) /home/nvidia/host/build_opencv/nv_opencv/modules/highgui/src/window_gtk.cpp:755: error: (-27:Null pointer) NULL window in function ‘cvGetModeWindow_GTK’

==> sudo apt install libcanberra-gtk-module libcanberra-gtk3-module

OK Passed

CPI is OK, Mem is used 40% (maybe 1.6G)
mikado2@mikado2-desktop:~/github/tensorrt_demos$ python3 trt_yolov3.py –model yolov3-608 –image –filename test_image.jpg

Leave a Reply

Your email address will not be published. Required fields are marked *