JPEG parameter struct mismatch: library thinks size is 584, caller expects 728 for python3 in Jetson

0

I am trying to run the darknet_video.py script for YOLO from here

in Jetson (nano and xavier NX). The code runs fine in one nano but not in another nano and NX. The script is run using the following command in Ubuntu 18.04 (Jetpack)

python3 darknet_video.py --input test.mp4 --out_filename out1.txt --weights yolov3-tiny.weights --ext_output --config_file yolov3-tiny.cfg --data_file coco.data --thresh 0.2

Receivng the follwing error in a nano and NX but it runs fine in another nano:

JPEG parameter struct mismatch: library thinks size is 584, caller expects 728
pure virtual method called
terminate called without an active exception
Aborted (core dumped)

Hi,

This may be related to the JPEG library:

May I know how to you install JPEG, OpenCV and darknet first?
Thanks.

@AastaLLL Sure, opencv 4.1 and CUDA 10.2 come preinstalled with Jetpack, I installed YOLO from here

The Jetson that runs fine was used by someone else before so I am not sure exactly what is fixing it, the one that I had a fresh installation (NX) in, I ran the following command but it did not fix the issue.

sudo apt-get install libjpeg-dev

Thanks in advance.

Hi,

We test darknet C++ interface with a built in video. It can work without any issue.

$ ./darknet detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights /opt/nvidia/deepstream/deepstream-5.0/samples/streams/sample_1080p_h264.mp4 -dont_show -ext_outpu

Could you also give the C++ executable a try?
Sometimes the library used between C++ and python will be different.

If the issue goes on, could you share the test.mp4 with us for checking?

Thanks.

Hello, I have the same problem. I guess the problem is because libjpeg.so and libnvjpeg.so exist together. I have both NVJPEG and OpenCV in my program, NVJPEG rely on libnvjpeg.so, OpenCV rely on libjpeg.so.
When doing TARGET_LINK_LIBRARIES, this error will occur if libjpeg.so is in front, and if libnvjpeg.so is in front, the segment fault will occur.
How can I solve this problem?

Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)

project(deepstream-xlaf)
set(project_name deepstream-xlaf)

add_compile_options(-O2 -pthread -Wall)
set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -std=c++11 -Ofast -Wfatal-errors -D_MWAITXINTRIN_H_INCLUDED”)

INCLUDE_DIRECTORIES(/usr/include)
INCLUDE_DIRECTORIES(/usr/include/glib-2.0)
INCLUDE_DIRECTORIES(/usr/include/json-glib-1.0)
INCLUDE_DIRECTORIES(/usr/include/gstreamer-1.0)
INCLUDE_DIRECTORIES(/usr/lib/aarch64-linux-gnu/glib-2.0/include)
LINK_DIRECTORIES(/usr/lib/aarch64-linux-gnu)
set(sys_libs pthread v4l2 dl m X11 json-glib-1.0 gobject-2.0 glib-2.0 jpeg)
set(gst_libs gstreamer-1.0 gstvideo-1.0 gstrtspserver-1.0)

LINK_DIRECTORIES(/usr/lib/aarch64-linux-gnu/tegra)
set(nv_libs nvbuf_utils nvbufsurface nvv4l2 nvjpeg)

INCLUDE_DIRECTORIES(/opt/nvidia/deepstream/deepstream-5.0/sources/includes)
INCLUDE_DIRECTORIES(/opt/nvidia/deepstream/deepstream-5.0/sources/apps/apps-common/includes)
LINK_DIRECTORIES(/opt/nvidia/deepstream/deepstream-5.0/lib)
set(nvds_libs nvds_utils nvds_meta nvds_msgbroker nvdsgst_meta nvdsgst_helper nvdsgst_smartrecord)

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/deepstream/common/include)

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/jetson_multimedia/include)

aux_source_directory(${PROJECT_SOURCE_DIR} src_list)
aux_source_directory(${PROJECT_SOURCE_DIR}/jetson_multimedia/src jpg_list)
aux_source_directory(${PROJECT_SOURCE_DIR}/deepstream/common/src dsc_list)

INCLUDE_DIRECTORIES(/usr/local/cuda/include)
LINK_DIRECTORIES(/usr/local/cuda/lib64)
SET(cuda_libs cudart)

INCLUDE_DIRECTORIES(/usr/local/include/opencv4)
LINK_DIRECTORIES(/usr/local/lib)
set(ocv_libs opencv_core opencv_imgproc opencv_highgui opencv_imgcodecs)

set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

add_executable(${project_name} ${src_list} ${jpg_list} ${dsc_list})

target_link_libraries(${project_name} ${sys_libs})
target_link_libraries(${project_name} ${gst_libs})
target_link_libraries(${project_name} ${nv_libs})
target_link_libraries(${project_name} ${nvds_libs})
target_link_libraries(${project_name} ${cuda_libs})
target_link_libraries(${project_name} ${ocv_libs})

Hi shenshen927,

Please help to open a new topic, thanks