Hello!
I would like to run object detection algorithm on existing video file in C++.
First step, I followed this tutorial: https://awesomeopensource.com/project/dusty-nv/jetson-inference. Everything worked well.
As second step, I integrated the detect-net programs into CodeLite IDE and it worked perfectly.
Now, I would like to run the object detection algorithm on existing video. I found this code: Added segnet-video and detectnet-video. by gcjyzdd · Pull Request #114 · dusty-nv/jetson-inference · GitHub.
I copied the c++ code into IDE and I got some error, the whole build message is the following:
/bin/sh -c ‘/usr/bin/make -j4 -e -f Makefile’
----------Building project:[ detectnet-video - Debug ]----------
make[1]: Entering directory ‘/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video’
/usr/bin/g++ -c “/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp” -g -O0 -std=c++14 -Wall -o ./Debug/main.cpp.o -I. -I. -I/usr/local/include/opencv2/ -I/usr/local/include -I/usr/local/include/jetson-inference -I/usr/local/include/jetson-utils -I/usr/local/cuda-10.2/targets/aarch64-linux/include -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include
In file included from /usr/local/include/jetson-inference/detectNet.h:27:0,
from /home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:6:
/usr/local/include/jetson-inference/tensorNet.h:41:27: warning: ‘DimsCHW’ is deprecated [-Wdeprecated-declarations]
typedef nvinfer1::DimsCHW Dims3;
^~~~~
In file included from /usr/local/include/jetson-inference/tensorNet.h:30:0,
from /usr/local/include/jetson-inference/detectNet.h:27,
from /home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:6:
/usr/include/aarch64-linux-gnu/NvInfer.h:206:22: note: declared here
class TRT_DEPRECATED DimsCHW : public Dims3
^~~~~~~
In file included from /usr/local/include/jetson-inference/detectNet.h:27:0,
from /home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:6:
/usr/local/include/jetson-inference/tensorNet.h:242:77: warning: ‘Dims3’ is deprecated [-Wdeprecated-declarations]
nvinfer1::IInt8Calibrator* calibrator=NULL, cudaStream_t stream=NULL );
^
In file included from /usr/local/include/jetson-inference/detectNet.h:27:0,
from /home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:6:
/usr/local/include/jetson-inference/tensorNet.h:401:73: warning: ‘Dims3’ is deprecated [-Wdeprecated-declarations]
nvinfer1::IInt8Calibrator* calibrator, std::ostream& modelStream);
^
In file included from /home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:6:0:
/usr/local/include/jetson-inference/detectNet.h:283:68: warning: ‘Dims3’ is deprecated [-Wdeprecated-declarations]
deviceType device=DEVICE_GPU, bool allowGPUFallback=true );
^
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp: In function ‘bool loadImageRGBA_video(cv::VideoCapture&, float4**, cv::Mat&, int, int)’:
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:48:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for( uint32_t y=0; y < imgHeight; y++ )
^~~~~~~~~
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:50:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for( uint32_t x=0; x < imgWidth; x++ )
^~~~~~~~
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp: In function ‘int main(int, char**)’:
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:99:33: error: ‘class detectNet’ has no member named ‘GetMaxBoundingBoxes’
const uint32_t maxBoxes = net->GetMaxBoundingBoxes(); printf(“maximum bounding boxes: %u\n”, maxBoxes);
^~~~~~~~~~~~~~~~~~~
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:188:98: error: no matching function for call to ‘detectNet::Detect(float*&, int&, int&, float*&, int*, float*&)’
const bool result = net->Detect(imgCUDA, imgWidth, imgHeight, bbCPU, &numBoundingBoxes, confCPU);
^
In file included from /home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:6:0:
/usr/local/include/jetson-inference/detectNet.h:309:6: note: candidate: int detectNet::Detect(float*, uint32_t, uint32_t, detectNet::Detection**, uint32_t)
int Detect( float* input, uint32_t width, uint32_t height, Detection** detections, uint32_t overlay=OVERLAY_BOX );
^~~~~~
/usr/local/include/jetson-inference/detectNet.h:309:6: note: candidate expects 5 arguments, 6 provided
/usr/local/include/jetson-inference/detectNet.h:321:6: note: candidate: int detectNet::Detect(float*, uint32_t, uint32_t, detectNet::Detection*, uint32_t)
int Detect( float* input, uint32_t width, uint32_t height, Detection* detections, uint32_t overlay=OVERLAY_BOX );
^~~~~~
/usr/local/include/jetson-inference/detectNet.h:321:6: note: candidate expects 5 arguments, 6 provided
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:192:8: error: in argument to unary !
if( !result )
^~~~~~
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:214:16: error: ‘class detectNet’ has no member named ‘DrawBoxes’
if( !net->DrawBoxes(imgCUDA, imgCUDA, imgWidth, imgHeight, bbCUDA + (lastStart * 4), (n - lastStart) + 1, lastClass) )
^~~~~~~~~
In file included from /usr/local/include/jetson-inference/tensorNet.h:32:0,
from /usr/local/include/jetson-inference/detectNet.h:27,
from /home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:6:
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:222:31: warning: ‘cudaError_t cudaThreadSynchronize()’ is deprecated [-Wdeprecated-declarations]
CUDA(cudaThreadSynchronize());
^
In file included from /usr/local/cuda-10.2/targets/aarch64-linux/include/channel_descriptor.h:61:0,
from /usr/local/cuda-10.2/targets/aarch64-linux/include/cuda_runtime.h:95,
from /usr/local/include/jetson-utils/cudaUtility.h:27,
from /usr/local/include/jetson-inference/tensorNet.h:32,
from /usr/local/include/jetson-inference/detectNet.h:27,
from /home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:6:
/usr/local/cuda-10.2/targets/aarch64-linux/include/cuda_runtime_api.h:957:57: note: declared here
extern __CUDA_DEPRECATED host cudaError_t CUDARTAPI cudaThreadSynchronize(void);
^~~~~~~~~~~~~~~~~~~~~
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:227:57: error: ‘NV_GIE_VERSION’ was not declared in this scope
sprintf(str, “TensorRT build %x | %s | %04.1f FPS”, NV_GIE_VERSION, net->HasFP16() ? “FP16” : “FP32”, display->GetFPS());
^~~~~~~~~~~~~~
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:227:57: note: suggested alternative: ‘_SC_VERSION’
sprintf(str, “TensorRT build %x | %s | %04.1f FPS”, NV_GIE_VERSION, net->HasFP16() ? “FP16” : “FP32”, display->GetFPS());
^~~~~~~~~~~~~~
_SC_VERSION
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:227:78: error: ‘class detectNet’ has no member named ‘HasFP16’
sprintf(str, “TensorRT build %x | %s | %04.1f FPS”, NV_GIE_VERSION, net->HasFP16() ? “FP16” : “FP32”, display->GetFPS());
^~~~~~~
/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video/main.cpp:159:12: warning: unused variable ‘font’ [-Wunused-variable]
cudaFont* font = cudaFont::Create();
^~~~
detectnet-video.mk:95: recipe for target ‘Debug/main.cpp.o’ failed
make[1]: *** [Debug/main.cpp.o] Error 1
make[1]: Leaving directory ‘/home/nvidia/Documents/CodeLite/Object_classification/detectnet-video’
Makefile:4: recipe for target ‘All’ failed
make: *** [All] Error 2
====7 errors, 23 warnings====
Please help me how to fix this errors, or if it is not the right method to achieve my goal, please let me know how to do it the right way.
Thank you!