AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.68k stars 7.96k forks source link

ARCH for Jetson Nano (MakeFile) #3149

Closed Tangotrax closed 3 years ago

Tangotrax commented 5 years ago

@AlexeyAB can you please tell the ARCH parameter to be passed in MakeFile for Jetson Nano

alexanderfrey commented 5 years ago

@Tangotrax You can use Compute capability 5.3 -> compute_53

Tangotrax commented 5 years ago

Thanks @alexanderfrey.

@AlexeyAB Is it good to go with what @alexanderfrey said

AvenSun commented 5 years ago

I have one Jetson Nano, as Alexander said , changing compute capability to 5.3 is enough .

i-chaochen commented 5 years ago

@AlexeyAB

I have uncommented the Makefile as the following: GPU=1 CUDNN=1 OPENCV=1 LIBSO=1 ARCH= -gencode arch=compute_53,code=[sm_53,compute_53]

But I don't know why my tiny-yolov3 is soooooo slow. The inference time is longer than 5000ms...Any idea why it so slow? It has huge difference in terms of inference time between TX2(around 30ms) and Nano....which I don't think it's normal.

AlexeyAB commented 5 years ago

do

make clean
make

Also show output of:

nvcc --version
nvidia-smi

What cuDNN version do you use?

i-chaochen commented 5 years ago

do

make clean
make

Also show output of:

nvcc --version
nvidia-smi

What cuDNN version do you use?

Thanks for reply! Currently I don't have Nano in my hand but I will try it tomorrow.

I installed its latest JetPack 4.2 SDK, and it said it supports NVIDIA CUDA Toolkit 10.0, and libraries such as cuDNN 7.3 and TensorRT 5.

AlexeyAB commented 5 years ago

Also show nvidia-smi output during yolov3-tiny detection on video

i-chaochen commented 5 years ago

Also show nvidia-smi output during yolov3-tiny detection on video

Since jetson nano does not have nvidia-smi, I tried jtop to monitor my gpu usage.

You're correct, it seems my gpu has never been used during the interference. Any idea why and how to resolve it? @AlexeyAB As I said, my Makefile is the following.

GPU=1 CUDNN=1 CUDNN_HALF=0 OPENCV=1 AVX=0 OPENMP=0 LIBSO=1 ZED_CAMERA=0

ARCH= -gencode arch=compute_53,code=[sm_53,compute_53]

AlexeyAB commented 5 years ago

Show output of command

make clean make

i-chaochen commented 5 years ago

Show output of command

make clean make

I cannnot compile by directly make, it shows

g++ -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV pkg-config --cflags opencv -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -fPIC -c ./src/image_opencv.cpp -o obj/image_opencv.o Package opencv was not found in the pkg-config search path. Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment variable No package 'opencv' found In file included from ./src/image_opencv.cpp:17:0: /usr/include/opencv2/opencv.hpp:56:10: fatal error: opencv2/calib3d.hpp: No such file or directory

include "opencv2/calib3d.hpp"

      ^~~~~~~~~~~~~~~~~~~~~

compilation terminated. Makefile:149: recipe for target 'obj/image_opencv.o' failed make: *** [obj/image_opencv.o] Error 1

But I can compile it if I tried cmake . make

Do you think is the reason I tried cmake and make instead of make?

AlexeyAB commented 5 years ago

If you use Cmake then it doesn't matter what did you set in the Makefile

GPU=1
CUDNN=1
CUDNN_HALF=0
OPENCV=1
AVX=0
OPENMP=0
LIBSO=1
ZED_CAMERA=0
i-chaochen commented 5 years ago

I compiled opencv4 from the source, it might change the pkg_config. I am writing a new one.

would it be largely different in terms of time if I don't use opencv?

i-chaochen commented 5 years ago

If you use Cmake then it doesn't matter what did you set in the Makefile

GPU=1
CUDNN=1
CUDNN_HALF=0
OPENCV=1
AVX=0
OPENMP=0
LIBSO=1
ZED_CAMERA=0
  • Or try to use original Makefile from this repo with GPU=1 CUDNN=1 OPENCV=0 and do make
  • Or enable CUDA compilation in Cmake and do cmake . & make

I changed the opencv=0, and make. Got the following error, is jetson nano use different nvcc?

nvcc -gencode arch=compute_53,code=[sm_53,compute_53] -Iinclude/ -I3rdparty/stb/include -DGPU -I/usr/local/cuda/include/ -DCUDNN --compiler-options "-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DGPU -DCUDNN -I/usr/local/cudnn/include -fPIC" -c ./src/convolutional_kernels.cu -o obj/convolutional_kernels.o /bin/sh: 1: nvcc: not found Makefile:152: recipe for target 'obj/convolutional_kernels.o' failed make: *** [obj/convolutional_kernels.o] Error 127

I tried 62, and it also failed.

nvcc -gencode arch=compute_62,code=[sm_62,compute_62] -Iinclude/ -I3rdparty/stb/include -DGPU -I/usr/local/cuda/include/ -DCUDNN --compiler-options "-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DGPU -DCUDNN -I/usr/local/cudnn/include -fPIC" -c ./src/convolutional_kernels.cu -o obj/convolutional_kernels.o /bin/sh: 1: nvcc: not found Makefile:152: recipe for target 'obj/convolutional_kernels.o' failed make: *** [obj/convolutional_kernels.o] Error 127

AlexeyAB commented 5 years ago

You just don't have CUDA installed.

i-chaochen commented 5 years ago

You just don't have CUDA installed.

I don't think so.

As I mentioned early, I installed JetPack 4.2, which included cuda10.0 , and I do find it in my /usr/local/cuda-10.0/

Maybe Jetson nano uses different cuda sdk?

i-chaochen commented 5 years ago

Ha, thanks for help.

I changed ./bashrc with cuda and now is working perfectly now.

Thanks!

aluds123 commented 5 years ago

@i-chaochen Hi,can you tell me what you do in ./bashrc??

Thanks

i-chaochen commented 4 years ago

@i-chaochen Hi,can you tell me what you do in ./bashrc??

Thanks

sorry to the late reply. It's just simply setting the path of installed cuda.

something like this following

export CUDA_HOME="/usr/local/cuda"
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH
export PATH="$PATH:$CUDA_HOME/bin"

and then running source ~/.basrhc

proepro5 commented 3 years ago

@AlexeyAB Hello, Hope you are well.

I downloaded the source code and it runs fine with no issues, thank you for that. Just wanted to know how to perform analytics on this solution (i.e. show on-screen messages, count how many objects it has detected over time etc). I have opened/inspected and changed code from the darknet.py and darknet_video.py files but with no success. Is this something I need to do in the cfg files? Kind regards