zhouyuchong / face-recognition-deepstream

Deepstream app use retinaface and arcface for face recognition.
MIT License
58 stars 12 forks source link

Can't compile customlib #38

Open neilyoung opened 1 month ago

neilyoung commented 1 month ago

Wondering how this compiles:

https://github.com/zhouyuchong/face-recognition-deepstream/blob/877f819ef0552441db3fadf28ac1e735977329fb/models/retinaface/nvdsinfer_customparser/nvdsparse_retinaface.cpp#L95

landmark is IMHO not part of this structure:

/**
 * Holds information about one parsed object from a detector's output.
 */
typedef struct
{
  /** Holds the ID of the class to which the object belongs. */
  unsigned int classId;

  /** Holds the horizontal offset of the bounding box shape for the object. */
  float left;
  /** Holds the vertical offset of the object's bounding box. */
  float top;
  /** Holds the width of the object's bounding box. */
  float width;
  /** Holds the height of the object's bounding box. */
  float height;

  /** Holds the object detection confidence level; must in the range
   [0.0,1.0]. */
  float detectionConfidence;
} NvDsInferObjectDetectionInfo;

Most likely I'm missing the custom lib header file

zhouyuchong commented 1 month ago

@neilyoung there you go.

neilyoung commented 1 month ago

@zhouyuchong Thanks. I must have been blind :)

neilyoung commented 1 month ago

Just in case you are interested. Tried the custom nvndsinfer build script on a 7.0 installation. Seem to have failed.

/gst-nvinfer-custom$ sudo ./install.sh
[2024-09-15 07:20:20] [INFO]check current directory
[2024-09-15 07:20:20] [INFO]backing up original files
[2024-09-15 07:20:20] [INFO]making backup dir
[2024-09-15 07:20:20] [INFO]backup libnvds_infer.so
[2024-09-15 07:20:20] [INFO]backup libnvdsgst_infer.so
[2024-09-15 07:20:20] [INFO]backup nvdsinfer.h
[2024-09-15 07:20:20] [INFO]CUDA Version: 11.5
Please input deepstream version(e.g. 6.0):7.0
[2024-09-15 07:20:29] [INFO]Installing dependencies
[2024-09-15 07:20:29] [INFO]Building nvdsinfer
g++ -c -o nvdsinfer_context_impl.o -fPIC -Wno-deprecated-declarations -std=c++14 -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes/ -DNDEBUG nvdsinfer_context_impl.cpp
g++ -c -o nvdsinfer_context_impl_capi.o -fPIC -Wno-deprecated-declarations -std=c++14 -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes/ -DNDEBUG nvdsinfer_context_impl_capi.cpp
g++ -c -o nvdsinfer_context_impl_output_parsing.o -fPIC -Wno-deprecated-declarations -std=c++14 -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes/ -DNDEBUG nvdsinfer_context_impl_output_parsing.cpp
g++ -c -o nvdsinfer_func_utils.o -fPIC -Wno-deprecated-declarations -std=c++14 -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes/ -DNDEBUG nvdsinfer_func_utils.cpp
g++ -c -o nvdsinfer_model_builder.o -fPIC -Wno-deprecated-declarations -std=c++14 -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes/ -DNDEBUG nvdsinfer_model_builder.cpp
g++ -c -o nvdsinfer_backend.o -fPIC -Wno-deprecated-declarations -std=c++14 -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes/ -DNDEBUG nvdsinfer_backend.cpp
-fPIC -Wno-deprecated-declarations -std=c++14 -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes/ -DNDEBUG
/usr/local/cuda-11.5/bin/nvcc -c -o nvdsinfer_conversion.o --compiler-options '-fPIC' nvdsinfer_conversion.cu
make: /usr/local/cuda-11.5/bin/nvcc: No such file or directory
make: *** [Makefile:70: nvdsinfer_conversion.o] Error 127
make: *** Waiting for unfinished jobs....
-fPIC -Wno-deprecated-declarations -std=c++14 -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes/ -DNDEBUG
/usr/local/cuda-11.5/bin/nvcc -c -o nvdsinfer_conversion.o --compiler-options '-fPIC' nvdsinfer_conversion.cu
make: /usr/local/cuda-11.5/bin/nvcc: No such file or directory
make: *** [Makefile:70: nvdsinfer_conversion.o] Error 127
[2024-09-15 07:20:32] [INFO]Building gst-nvinfer
g++ -c -o gstnvinfer.o -fPIC -std=c++11 -DDS_VERSION=\"7.0\" -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes -I /opt/nvidia/deepstream/deepstream-7.0/sources/gst-plugins/gst-nvdspreprocess/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvdsinfer -DNDEBUG -pthread -I/usr/include/opencv4 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include gstnvinfer.cpp
g++ -c -o gstnvinfer_allocator.o -fPIC -std=c++11 -DDS_VERSION=\"7.0\" -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes -I /opt/nvidia/deepstream/deepstream-7.0/sources/gst-plugins/gst-nvdspreprocess/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvdsinfer -DNDEBUG -pthread -I/usr/include/opencv4 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include gstnvinfer_allocator.cpp
g++ -c -o gstnvinfer_property_parser.o -fPIC -std=c++11 -DDS_VERSION=\"7.0\" -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes -I /opt/nvidia/deepstream/deepstream-7.0/sources/gst-plugins/gst-nvdspreprocess/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvdsinfer -DNDEBUG -pthread -I/usr/include/opencv4 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include gstnvinfer_property_parser.cpp
g++ -c -o gstnvinfer_meta_utils.o -fPIC -std=c++11 -DDS_VERSION=\"7.0\" -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes -I /opt/nvidia/deepstream/deepstream-7.0/sources/gst-plugins/gst-nvdspreprocess/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvdsinfer -DNDEBUG -pthread -I/usr/include/opencv4 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include gstnvinfer_meta_utils.cpp
g++ -c -o gstnvinfer_impl.o -fPIC -std=c++11 -DDS_VERSION=\"7.0\" -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes -I /opt/nvidia/deepstream/deepstream-7.0/sources/gst-plugins/gst-nvdspreprocess/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvdsinfer -DNDEBUG -pthread -I/usr/include/opencv4 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include gstnvinfer_impl.cpp
In file included from gstnvinfer_meta_utils.cpp:17:
gstnvinfer_meta_utils.cpp: In function ‘void attach_metadata_detector(GstNvInfer*, GstMiniObject*, GstNvInferFrame&, NvDsInferDetectionOutput&, float)’:
gstnvinfer_meta_utils.h:23:64: warning: ISO C++ forbids converting a string constant to ‘gchar*’ {aka ‘char*’} [-Wwrite-strings]
   23 | #define NVDS_USER_OBJECT_META_EXAMPLE (nvds_get_user_meta_type("NVIDIA.NVINFER.USER_META"))
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
gstnvinfer_meta_utils.h:23:64: note: in definition of macro ‘NVDS_USER_OBJECT_META_EXAMPLE’
   23 | #define NVDS_USER_OBJECT_META_EXAMPLE (nvds_get_user_meta_type("NVIDIA.NVINFER.USER_META"))
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
gstnvinfer_meta_utils.cpp: In function ‘void* copy_segmentation_meta(gpointer, gpointer)’:
gstnvinfer_meta_utils.cpp:426:38: warning: ‘void* g_memdup(gconstpointer, guint)’ is deprecated: Use 'g_memdup2' instead [-Wdeprecated-declarations]
  426 |   meta->class_map = (gint *) g_memdup(src_meta->class_map, meta->width * meta->height * sizeof (gint));
      |                              ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:82,
                 from /usr/include/gstreamer-1.0/gst/gst.h:27,
                 from /usr/include/gstreamer-1.0/gst/base/gstbasetransform.h:24,
                 from gstnvinfer.h:15,
                 from gstnvinfer_meta_utils.h:19,
                 from gstnvinfer_meta_utils.cpp:17:
/usr/include/glib-2.0/glib/gstrfuncs.h:257:23: note: declared here
  257 | gpointer              g_memdup         (gconstpointer mem,
      |                       ^~~~~~~~
gstnvinfer_meta_utils.cpp:427:54: warning: ‘void* g_memdup(gconstpointer, guint)’ is deprecated: Use 'g_memdup2' instead [-Wdeprecated-declarations]
  427 |   meta->class_probabilities_map = (gfloat *) g_memdup(src_meta->class_probabilities_map, meta->classes * meta->width * meta->height * sizeof (gfloat));
      |                                              ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:82,
                 from /usr/include/gstreamer-1.0/gst/gst.h:27,
                 from /usr/include/gstreamer-1.0/gst/base/gstbasetransform.h:24,
                 from gstnvinfer.h:15,
                 from gstnvinfer_meta_utils.h:19,
                 from gstnvinfer_meta_utils.cpp:17:
/usr/include/glib-2.0/glib/gstrfuncs.h:257:23: note: declared here
  257 | gpointer              g_memdup         (gconstpointer mem,
      |                       ^~~~~~~~
gstnvinfer_meta_utils.cpp: In function ‘void* copy_tensor_output_meta(gpointer, gpointer)’:
gstnvinfer_meta_utils.cpp:505:39: warning: ‘void* g_memdup(gconstpointer, guint)’ is deprecated: Use 'g_memdup2' instead [-Wdeprecated-declarations]
  505 |       (NvDsInferLayerInfo *) g_memdup (src_meta->output_layers_info,
      |                              ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  506 |       src_meta->num_output_layers * sizeof (NvDsInferLayerInfo));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/glib-2.0/glib.h:82,
                 from /usr/include/gstreamer-1.0/gst/gst.h:27,
                 from /usr/include/gstreamer-1.0/gst/base/gstbasetransform.h:24,
                 from gstnvinfer.h:15,
                 from gstnvinfer_meta_utils.h:19,
                 from gstnvinfer_meta_utils.cpp:17:
/usr/include/glib-2.0/glib/gstrfuncs.h:257:23: note: declared here
  257 | gpointer              g_memdup         (gconstpointer mem,
      |                       ^~~~~~~~
In file included from /usr/include/glib-2.0/glib/gthread.h:32,
                 from /usr/include/glib-2.0/glib/gasyncqueue.h:32,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/gstreamer-1.0/gst/gst.h:27,
                 from /opt/nvidia/deepstream/deepstream-7.0/sources/includes/gst-nvevent.h:36,
                 from gstnvinfer.cpp:25:
gstnvinfer.cpp: In function ‘GType gst_nvinfer_process_mode_get_type()’:
/usr/include/glib-2.0/glib/gatomic.h:113:19: error: argument 2 of ‘__atomic_load’ must not be a pointer to a ‘volatile’ type
  113 |     __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gthread.h:260:7: note: in expansion of macro ‘g_atomic_pointer_get’
  260 |     (!g_atomic_pointer_get (location) &&                             \
      |       ^~~~~~~~~~~~~~~~~~~~
gstnvinfer.cpp:169:7: note: in expansion of macro ‘g_once_init_enter’
  169 |   if (g_once_init_enter (&process_mode_type)) {
      |       ^~~~~~~~~~~~~~~~~
In file included from gstnvinfer.cpp:31:
gstnvinfer.cpp: In function ‘GstFlowReturn gst_nvinfer_process_objects(GstNvInfer*, GstBuffer*, NvBufSurface*)’:
gstnvinfer_meta_utils.h:23:64: warning: ISO C++ forbids converting a string constant to ‘gchar*’ {aka ‘char*’} [-Wwrite-strings]
   23 | #define NVDS_USER_OBJECT_META_EXAMPLE (nvds_get_user_meta_type("NVIDIA.NVINFER.USER_META"))
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
gstnvinfer_meta_utils.h:23:64: note: in definition of macro ‘NVDS_USER_OBJECT_META_EXAMPLE’
   23 | #define NVDS_USER_OBJECT_META_EXAMPLE (nvds_get_user_meta_type("NVIDIA.NVINFER.USER_META"))
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
gstnvinfer_impl.cpp: In member function ‘bool gstnvinfer::DsNvInferImpl::initNewInferModelParams(NvDsInferContextInitParams&, const string&, gstnvinfer::ModelLoadType, const NvDsInferContextInitParams&)’:
gstnvinfer_impl.cpp:269:13: warning: ‘_NvDsInferContextInitParams::useDBScan’ is deprecated: Use NvDsInferClusterMode instead [-Wdeprecated-declarations]
  269 |   newParams.useDBScan = oldParams.useDBScan;
      |             ^~~~~~~~~
In file included from gstnvinfer_impl.h:28,
                 from gstnvinfer_impl.cpp:17:
/opt/nvidia/deepstream/deepstream-7.0/sources/includes/nvdsinfer_context.h:318:9: note: declared here
  318 |     int useDBScan;
      |         ^~~~~~~~~
gstnvinfer_impl.cpp:269:13: warning: ‘_NvDsInferContextInitParams::useDBScan’ is deprecated: Use NvDsInferClusterMode instead [-Wdeprecated-declarations]
  269 |   newParams.useDBScan = oldParams.useDBScan;
      |             ^~~~~~~~~
In file included from gstnvinfer_impl.h:28,
                 from gstnvinfer_impl.cpp:17:
/opt/nvidia/deepstream/deepstream-7.0/sources/includes/nvdsinfer_context.h:318:9: note: declared here
  318 |     int useDBScan;
      |         ^~~~~~~~~
gstnvinfer_impl.cpp:269:13: warning: ‘_NvDsInferContextInitParams::useDBScan’ is deprecated: Use NvDsInferClusterMode instead [-Wdeprecated-declarations]
  269 |   newParams.useDBScan = oldParams.useDBScan;
      |             ^~~~~~~~~
In file included from gstnvinfer_impl.h:28,
                 from gstnvinfer_impl.cpp:17:
/opt/nvidia/deepstream/deepstream-7.0/sources/includes/nvdsinfer_context.h:318:9: note: declared here
  318 |     int useDBScan;
      |         ^~~~~~~~~
gstnvinfer_impl.cpp:269:35: warning: ‘_NvDsInferContextInitParams::useDBScan’ is deprecated: Use NvDsInferClusterMode instead [-Wdeprecated-declarations]
  269 |   newParams.useDBScan = oldParams.useDBScan;
      |                                   ^~~~~~~~~
In file included from gstnvinfer_impl.h:28,
                 from gstnvinfer_impl.cpp:17:
/opt/nvidia/deepstream/deepstream-7.0/sources/includes/nvdsinfer_context.h:318:9: note: declared here
  318 |     int useDBScan;
      |         ^~~~~~~~~
gstnvinfer_impl.cpp:269:35: warning: ‘_NvDsInferContextInitParams::useDBScan’ is deprecated: Use NvDsInferClusterMode instead [-Wdeprecated-declarations]
  269 |   newParams.useDBScan = oldParams.useDBScan;
      |                                   ^~~~~~~~~
In file included from gstnvinfer_impl.h:28,
                 from gstnvinfer_impl.cpp:17:
/opt/nvidia/deepstream/deepstream-7.0/sources/includes/nvdsinfer_context.h:318:9: note: declared here
  318 |     int useDBScan;
      |         ^~~~~~~~~
gstnvinfer_impl.cpp:269:35: warning: ‘_NvDsInferContextInitParams::useDBScan’ is deprecated: Use NvDsInferClusterMode instead [-Wdeprecated-declarations]
  269 |   newParams.useDBScan = oldParams.useDBScan;
      |                                   ^~~~~~~~~
In file included from gstnvinfer_impl.h:28,
                 from gstnvinfer_impl.cpp:17:
/opt/nvidia/deepstream/deepstream-7.0/sources/includes/nvdsinfer_context.h:318:9: note: declared here
  318 |     int useDBScan;
      |         ^~~~~~~~~
g++ -c -o gstnvinfer_yaml_parser.o -fPIC -std=c++11 -DDS_VERSION=\"7.0\" -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes -I /opt/nvidia/deepstream/deepstream-7.0/sources/gst-plugins/gst-nvdspreprocess/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvdsinfer -DNDEBUG -pthread -I/usr/include/opencv4 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include gstnvinfer_yaml_parser.cpp
g++ -c -o align_functions.o -fPIC -std=c++11 -DDS_VERSION=\"7.0\" -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes -I /opt/nvidia/deepstream/deepstream-7.0/sources/gst-plugins/gst-nvdspreprocess/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvdsinfer -DNDEBUG -pthread -I/usr/include/opencv4 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include align_functions.cpp
gstnvinfer.cpp: In function ‘std::tuple<cv::Mat, cv::Mat> get_images(GstNvInfer*, NvDsObjectMeta*, float, float, float (*)[2])’:
gstnvinfer.cpp:1542:1: warning: control reaches end of non-void function [-Wreturn-type]
 1542 | }
      | ^
gstnvinfer.cpp: In function ‘cv::Mat align_preprocess(NvBufSurface*, cv::Mat&, int, int, cv::Mat&)’:
gstnvinfer.cpp:1591:1: warning: control reaches end of non-void function [-Wreturn-type]
 1591 | }
      | ^
make: *** [Makefile:54: gstnvinfer.o] Error 1
make: *** Waiting for unfinished jobs....
g++ -c -o gstnvinfer.o -fPIC -std=c++11 -DDS_VERSION=\"7.0\" -I /usr/local/cuda-11.5/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes -I /opt/nvidia/deepstream/deepstream-7.0/sources/gst-plugins/gst-nvdspreprocess/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvdsinfer -DNDEBUG -pthread -I/usr/include/opencv4 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include gstnvinfer.cpp
In file included from /usr/include/glib-2.0/glib/gthread.h:32,
                 from /usr/include/glib-2.0/glib/gasyncqueue.h:32,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/gstreamer-1.0/gst/gst.h:27,
                 from /opt/nvidia/deepstream/deepstream-7.0/sources/includes/gst-nvevent.h:36,
                 from gstnvinfer.cpp:25:
gstnvinfer.cpp: In function ‘GType gst_nvinfer_process_mode_get_type()’:
/usr/include/glib-2.0/glib/gatomic.h:113:19: error: argument 2 of ‘__atomic_load’ must not be a pointer to a ‘volatile’ type
  113 |     __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gthread.h:260:7: note: in expansion of macro ‘g_atomic_pointer_get’
  260 |     (!g_atomic_pointer_get (location) &&                             \
      |       ^~~~~~~~~~~~~~~~~~~~
gstnvinfer.cpp:169:7: note: in expansion of macro ‘g_once_init_enter’
  169 |   if (g_once_init_enter (&process_mode_type)) {
      |       ^~~~~~~~~~~~~~~~~
In file included from gstnvinfer.cpp:31:
gstnvinfer.cpp: In function ‘GstFlowReturn gst_nvinfer_process_objects(GstNvInfer*, GstBuffer*, NvBufSurface*)’:
gstnvinfer_meta_utils.h:23:64: warning: ISO C++ forbids converting a string constant to ‘gchar*’ {aka ‘char*’} [-Wwrite-strings]
   23 | #define NVDS_USER_OBJECT_META_EXAMPLE (nvds_get_user_meta_type("NVIDIA.NVINFER.USER_META"))
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
gstnvinfer_meta_utils.h:23:64: note: in definition of macro ‘NVDS_USER_OBJECT_META_EXAMPLE’
   23 | #define NVDS_USER_OBJECT_META_EXAMPLE (nvds_get_user_meta_type("NVIDIA.NVINFER.USER_META"))
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
gstnvinfer.cpp: In function ‘std::tuple<cv::Mat, cv::Mat> get_images(GstNvInfer*, NvDsObjectMeta*, float, float, float (*)[2])’:
gstnvinfer.cpp:1542:1: warning: control reaches end of non-void function [-Wreturn-type]
 1542 | }
      | ^
gstnvinfer.cpp: In function ‘cv::Mat align_preprocess(NvBufSurface*, cv::Mat&, int, int, cv::Mat&)’:
gstnvinfer.cpp:1591:1: warning: control reaches end of non-void function [-Wreturn-type]
 1591 | }
      | ^
make: *** [Makefile:54: gstnvinfer.o] Error 1
[2024-09-15 07:20:41] [SUCCESS]install success
neilyoung commented 1 month ago

:) The restore script worked

EDIT: Maybe it has to do with the wrong detection of my CUDA version (which is 12.2)

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:02:13_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0

Yes, executing the script as sudo reveals 11.5 as CUDA version, but 12.2 as ordinary user... Strange

EDIT2: But this wasn't the reason for the fail. Problems persist.

sudo ./install.sh 
[2024-09-15 07:30:00] [INFO]check current directory
[2024-09-15 07:30:00] [INFO]backing up original files
[2024-09-15 07:30:00] [INFO]making backup dir
[2024-09-15 07:30:00] [INFO]backup libnvds_infer.so
[2024-09-15 07:30:00] [INFO]backup libnvdsgst_infer.so
[2024-09-15 07:30:00] [INFO]backup nvdsinfer.h
[2024-09-15 07:30:00] [INFO]CUDA Version: 12.2
Please input deepstream version(e.g. 6.0):7.0
[2024-09-15 07:30:05] [INFO]Installing dependencies
[2024-09-15 07:30:05] [INFO]Building nvdsinfer
-fPIC -Wno-deprecated-declarations -std=c++14 -I /usr/local/cuda-12.2/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes/ -DNDEBUG
/usr/local/cuda-12.2/bin/nvcc -c -o nvdsinfer_conversion.o --compiler-options '-fPIC' nvdsinfer_conversion.cu
-fPIC -Wno-deprecated-declarations -std=c++14 -I /usr/local/cuda-12.2/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes/ -DNDEBUG
g++ -o libnvds_infer.so nvdsinfer_context_impl.o nvdsinfer_context_impl_capi.o nvdsinfer_context_impl_output_parsing.o nvdsinfer_func_utils.o nvdsinfer_model_builder.o nvdsinfer_backend.o nvdsinfer_conversion.o -shared -Wl,-no-undefined -lnvinfer -lnvinfer_plugin -lnvonnxparser -lnvparsers -lpthread -L/usr/local/cuda-12.2/lib64/ -lcudart -L/opt/nvidia/deepstream/deepstream-7.0/lib/ -lnvdsgst_helper -lnvdsgst_meta -lnvds_meta -lnvds_inferlogger -lnvds_inferutils -ldl -Wl,-rpath,/opt/nvidia/deepstream/deepstream-7.0/lib/
cp -rv libnvds_infer.so /opt/nvidia/deepstream/deepstream-7.0/lib/
'libnvds_infer.so' -> '/opt/nvidia/deepstream/deepstream-7.0/lib/libnvds_infer.so'
[2024-09-15 07:30:07] [INFO]Building gst-nvinfer
g++ -c -o gstnvinfer.o -fPIC -std=c++11 -DDS_VERSION=\"7.0\" -I /usr/local/cuda-12.2/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes -I /opt/nvidia/deepstream/deepstream-7.0/sources/gst-plugins/gst-nvdspreprocess/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvdsinfer -DNDEBUG -pthread -I/usr/include/opencv4 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include gstnvinfer.cpp
In file included from /usr/include/glib-2.0/glib/gthread.h:32,
                 from /usr/include/glib-2.0/glib/gasyncqueue.h:32,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/gstreamer-1.0/gst/gst.h:27,
                 from /opt/nvidia/deepstream/deepstream-7.0/sources/includes/gst-nvevent.h:36,
                 from gstnvinfer.cpp:25:
gstnvinfer.cpp: In function ‘GType gst_nvinfer_process_mode_get_type()’:
/usr/include/glib-2.0/glib/gatomic.h:113:19: error: argument 2 of ‘__atomic_load’ must not be a pointer to a ‘volatile’ type
  113 |     __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gthread.h:260:7: note: in expansion of macro ‘g_atomic_pointer_get’
  260 |     (!g_atomic_pointer_get (location) &&                             \
      |       ^~~~~~~~~~~~~~~~~~~~
gstnvinfer.cpp:169:7: note: in expansion of macro ‘g_once_init_enter’
  169 |   if (g_once_init_enter (&process_mode_type)) {
      |       ^~~~~~~~~~~~~~~~~
In file included from gstnvinfer.cpp:31:
gstnvinfer.cpp: In function ‘GstFlowReturn gst_nvinfer_process_objects(GstNvInfer*, GstBuffer*, NvBufSurface*)’:
gstnvinfer_meta_utils.h:23:64: warning: ISO C++ forbids converting a string constant to ‘gchar*’ {aka ‘char*’} [-Wwrite-strings]
   23 | #define NVDS_USER_OBJECT_META_EXAMPLE (nvds_get_user_meta_type("NVIDIA.NVINFER.USER_META"))
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
gstnvinfer_meta_utils.h:23:64: note: in definition of macro ‘NVDS_USER_OBJECT_META_EXAMPLE’
   23 | #define NVDS_USER_OBJECT_META_EXAMPLE (nvds_get_user_meta_type("NVIDIA.NVINFER.USER_META"))
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
gstnvinfer.cpp: In function ‘std::tuple<cv::Mat, cv::Mat> get_images(GstNvInfer*, NvDsObjectMeta*, float, float, float (*)[2])’:
gstnvinfer.cpp:1542:1: warning: control reaches end of non-void function [-Wreturn-type]
 1542 | }
      | ^
gstnvinfer.cpp: In function ‘cv::Mat align_preprocess(NvBufSurface*, cv::Mat&, int, int, cv::Mat&)’:
gstnvinfer.cpp:1591:1: warning: control reaches end of non-void function [-Wreturn-type]
 1591 | }
      | ^
make: *** [Makefile:54: gstnvinfer.o] Error 1
g++ -c -o gstnvinfer.o -fPIC -std=c++11 -DDS_VERSION=\"7.0\" -I /usr/local/cuda-12.2/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/includes -I /opt/nvidia/deepstream/deepstream-7.0/sources/gst-plugins/gst-nvdspreprocess/include -I /opt/nvidia/deepstream/deepstream-7.0/sources/libs/nvdsinfer -DNDEBUG -pthread -I/usr/include/opencv4 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include gstnvinfer.cpp
In file included from /usr/include/glib-2.0/glib/gthread.h:32,
                 from /usr/include/glib-2.0/glib/gasyncqueue.h:32,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/gstreamer-1.0/gst/gst.h:27,
                 from /opt/nvidia/deepstream/deepstream-7.0/sources/includes/gst-nvevent.h:36,
                 from gstnvinfer.cpp:25:
gstnvinfer.cpp: In function ‘GType gst_nvinfer_process_mode_get_type()’:
/usr/include/glib-2.0/glib/gatomic.h:113:19: error: argument 2 of ‘__atomic_load’ must not be a pointer to a ‘volatile’ type
  113 |     __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gthread.h:260:7: note: in expansion of macro ‘g_atomic_pointer_get’
  260 |     (!g_atomic_pointer_get (location) &&                             \
      |       ^~~~~~~~~~~~~~~~~~~~
gstnvinfer.cpp:169:7: note: in expansion of macro ‘g_once_init_enter’
  169 |   if (g_once_init_enter (&process_mode_type)) {
      |       ^~~~~~~~~~~~~~~~~
In file included from gstnvinfer.cpp:31:
gstnvinfer.cpp: In function ‘GstFlowReturn gst_nvinfer_process_objects(GstNvInfer*, GstBuffer*, NvBufSurface*)’:
gstnvinfer_meta_utils.h:23:64: warning: ISO C++ forbids converting a string constant to ‘gchar*’ {aka ‘char*’} [-Wwrite-strings]
   23 | #define NVDS_USER_OBJECT_META_EXAMPLE (nvds_get_user_meta_type("NVIDIA.NVINFER.USER_META"))
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
gstnvinfer_meta_utils.h:23:64: note: in definition of macro ‘NVDS_USER_OBJECT_META_EXAMPLE’
   23 | #define NVDS_USER_OBJECT_META_EXAMPLE (nvds_get_user_meta_type("NVIDIA.NVINFER.USER_META"))
      |                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
gstnvinfer.cpp: In function ‘std::tuple<cv::Mat, cv::Mat> get_images(GstNvInfer*, NvDsObjectMeta*, float, float, float (*)[2])’:
gstnvinfer.cpp:1542:1: warning: control reaches end of non-void function [-Wreturn-type]
 1542 | }
      | ^
gstnvinfer.cpp: In function ‘cv::Mat align_preprocess(NvBufSurface*, cv::Mat&, int, int, cv::Mat&)’:
gstnvinfer.cpp:1591:1: warning: control reaches end of non-void function [-Wreturn-type]
 1591 | }
      | ^
make: *** [Makefile:54: gstnvinfer.o] Error 1
[2024-09-15 07:30:12] [SUCCESS]install success

Anyway, don't bother. It seems to have had its time. As all the stuff in this business...

zhouyuchong commented 1 month ago

@neilyoung so there is only one error

In file included from /usr/include/glib-2.0/glib/gthread.h:32,
                 from /usr/include/glib-2.0/glib/gasyncqueue.h:32,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/gstreamer-1.0/gst/gst.h:27,
                 from /opt/nvidia/deepstream/deepstream-7.0/sources/includes/gst-nvevent.h:36,
                 from gstnvinfer.cpp:25:
gstnvinfer.cpp: In function ‘GType gst_nvinfer_process_mode_get_type()’:
/usr/include/glib-2.0/glib/gatomic.h:113:19: error: argument 2 of ‘__atomic_load’ must not be a pointer to a ‘volatile’ type
  113 |     __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gthread.h:260:7: note: in expansion of macro ‘g_atomic_pointer_get’
  260 |     (!g_atomic_pointer_get (location) &&                             \
      |       ^~~~~~~~~~~~~~~~~~~~
gstnvinfer.cpp:169:7: note: in expansion of macro ‘g_once_init_enter’
  169 |   if (g_once_init_enter (&process_mode_type)) {
      |       ^~~~~~~~~~~~~~~~~

I never met this before, I guess it's related to gstreamer version. You can check the source code for gst-nvinfer in deepstream 7.0 to see the differences since you say the original plugin compile and work fine. there might be some changes, i'll check this later.

neilyoung commented 1 month ago

Thanks for the follow up. I found another way to solve my FR problem: Using a tandem of Facenet (detection) and Face Recognition ResNet 100 arcface (https://github.com/openvinotoolkit/open_model_zoo/blob/master/models/public/face-recognition-resnet100-arcface-onnx/README.md). This drops the need to mess with all the thousands of anchors delivered by the model you were using. It delivers a 512 float fingerprint vector. Even w/o face normalisation it shows good results in comparisons using Cosine distance.