Bug Summary

File:/home/gilles/Devel/8.x/core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp
Warning:line 125, column 39
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple aarch64-unknown-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name dnnfacedetectorssd.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=non-leaf -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu generic -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -target-abi aapcs -debugger-tuning=gdb -fdebug-compilation-dir=/home/gilles/Devel/8.x/build.scan/core/libs/facesengine -fcoverage-compilation-dir=/home/gilles/Devel/8.x/build.scan/core/libs/facesengine -resource-dir /usr/lib/llvm-18/lib/clang/18 -D BUILDING_XMPCOMPAREANDMERGE_AS_STATIC=1 -D BUILDING_XMPCOMPAREANDMERGE_LIB=1 -D BanAllEntityUsage=1 -D CMS_NO_REGISTER_KEYWORD=1 -D EnablePluginManager=0 -D HAVE_FFMPEG_VERSION5 -D LIBPGF_DISABLE_OPENMP -D LINKING_XMPCORE_LIB=1 -D MAGICKCORE_HDRI_ENABLE=0 -D MAGICKCORE_QUANTUM_DEPTH=16 -D QT_DEPRECATED_WARNINGS -D QT_DEPRECATED_WARNINGS_SINCE=0x060000 -D QT_DISABLE_DEPRECATED_BEFORE=0x050E00 -D QT_NO_CAST_FROM_ASCII -D QT_NO_CAST_FROM_BYTEARRAY -D QT_NO_CAST_TO_ASCII -D QT_NO_FOREACH -D QT_NO_KEYWORDS -D QT_NO_NARROWING_CONVERSIONS_IN_CONNECT -D QT_NO_URL_CAST_FROM_STRING -D QT_STRICT_ITERATORS -D QT_USE_QSTRINGBUILDER -D TRANSLATION_DOMAIN="digikam" -D UNIX_ENV=1 -D USE_JASPER -D USE_JPEG -D USE_JPEG8 -D XMP_COMPONENT_INT_NAMESPACE=AdobeXMPCompareAndMerge_Int -D XMP_StaticBuild=1 -D _GNU_SOURCE -D _LARGEFILE64_SOURCE -D digikamcore_EXPORTS -D qDNGDebug=0 -D qDNGLittleEndian=1 -D qDNGThreadSafe=1 -D qDNGUseLibJPEG=1 -D qDNGUseStdInt=1 -D qDNGUseXMP=1 -D qDNGValidateTarget=1 -D qDNGXMPDocOps=0 -D qDNGXMPFiles=0 -D qLinux=1 -D qMacOS=0 -D qWinOS=0 -I /home/gilles/Devel/8.x/build.scan/core/libs/facesengine -I /home/gilles/Devel/8.x/core/libs/facesengine -I /home/gilles/Devel/8.x/build.scan/core/libs/facesengine/core_digikamfacesengine_obj_autogen/include -I /home/gilles/Devel/8.x/core/libs/video/player/qtmm -I /home/gilles/Devel/8.x/core/libs/album/engine -I /home/gilles/Devel/8.x/core/libs/album/manager -I /home/gilles/Devel/8.x/core/libs/album/treeview -I /home/gilles/Devel/8.x/core/libs/album/widgets -I /home/gilles/Devel/8.x/core/libs/database/collection -I /home/gilles/Devel/8.x/core/libs/database/coredb -I /home/gilles/Devel/8.x/core/libs/database/dbjobs -I /home/gilles/Devel/8.x/core/libs/database/engine -I /home/gilles/Devel/8.x/core/libs/database/haar -I /home/gilles/Devel/8.x/core/libs/database/history -I /home/gilles/Devel/8.x/core/libs/database/item/containers -I /home/gilles/Devel/8.x/core/libs/database/item/lister -I /home/gilles/Devel/8.x/core/libs/database/item/query -I /home/gilles/Devel/8.x/core/libs/database/item/scanner -I /home/gilles/Devel/8.x/core/libs/database/models -I /home/gilles/Devel/8.x/core/libs/database/server -I /home/gilles/Devel/8.x/core/libs/database/similaritydb -I /home/gilles/Devel/8.x/core/libs/database/tags -I /home/gilles/Devel/8.x/core/libs/database/thumbsdb -I /home/gilles/Devel/8.x/core/libs/database/utils/ifaces -I /home/gilles/Devel/8.x/core/libs/database/utils/scan -I /home/gilles/Devel/8.x/core/libs/database/utils/widgets -I /home/gilles/Devel/8.x/core/libs/dialogs -I /home/gilles/Devel/8.x/core/libs/dimg/color -I /home/gilles/Devel/8.x/core/libs/dimg -I /home/gilles/Devel/8.x/core/libs/dimg/filters/auto -I /home/gilles/Devel/8.x/core/libs/dimg/filters/bcg -I /home/gilles/Devel/8.x/core/libs/dimg/filters/bw -I /home/gilles/Devel/8.x/core/libs/dimg/filters/cb -I /home/gilles/Devel/8.x/core/libs/dimg/filters/curves -I /home/gilles/Devel/8.x/core/libs/dimg/filters/decorate -I /home/gilles/Devel/8.x/core/libs/dimg/filters -I /home/gilles/Devel/8.x/core/libs/dimg/filters/film -I /home/gilles/Devel/8.x/core/libs/dimg/filters/fx -I /home/gilles/Devel/8.x/core/libs/dimg/filters/greycstoration/cimg -I /home/gilles/Devel/8.x/core/libs/dimg/filters/greycstoration -I /home/gilles/Devel/8.x/core/libs/dimg/filters/hotpixels -I /home/gilles/Devel/8.x/core/libs/dimg/filters/hsl -I /home/gilles/Devel/8.x/core/libs/dimg/filters/icc -I /home/gilles/Devel/8.x/core/libs/dimg/filters/lc -I /home/gilles/Devel/8.x/core/libs/dimg/filters/lens -I /home/gilles/Devel/8.x/core/libs/dimg/filters/levels -I /home/gilles/Devel/8.x/core/libs/dimg/filters/nr -I /home/gilles/Devel/8.x/core/libs/dimg/filters/raw -I /home/gilles/Devel/8.x/core/libs/dimg/filters/redeye -I /home/gilles/Devel/8.x/core/libs/dimg/filters/sharp -I /home/gilles/Devel/8.x/core/libs/dimg/filters/transform -I /home/gilles/Devel/8.x/core/libs/dimg/filters/wb -I /home/gilles/Devel/8.x/core/libs/dimg/history -I /home/gilles/Devel/8.x/core/libs/dimg/loaders -I /home/gilles/Devel/8.x/core/libs/dngwriter -I /home/gilles/Devel/8.x/core/libs/dnnmodelmanager -I /home/gilles/Devel/8.x/core/libs/dplugins/core -I /home/gilles/Devel/8.x/core/libs/dplugins/iface -I /home/gilles/Devel/8.x/core/libs/dplugins/setup -I /home/gilles/Devel/8.x/core/libs/dplugins/webservices -I /home/gilles/Devel/8.x/core/libs/dplugins/widgets -I /home/gilles/Devel/8.x/core/libs/dragdrop -I /home/gilles/Devel/8.x/core/libs/dtrash -I /home/gilles/Devel/8.x/core/libs/facesengine/common -I /home/gilles/Devel/8.x/core/libs/facesengine/detection -I /home/gilles/Devel/8.x/core/libs/facesengine/detection/opencv-dnn -I /home/gilles/Devel/8.x/core/libs/facesengine/facedb -I /home/gilles/Devel/8.x/core/libs/facesengine/preprocessing -I /home/gilles/Devel/8.x/core/libs/facesengine/preprocessing/recognition -I /home/gilles/Devel/8.x/core/libs/facesengine/preprocessing/shape-predictor -I /home/gilles/Devel/8.x/core/libs/facesengine/recognition -I /home/gilles/Devel/8.x/core/libs/facesengine/recognition/opencv-dnn -I /home/gilles/Devel/8.x/core/libs/fileactionmanager -I /home/gilles/Devel/8.x/core/libs/filters -I /home/gilles/Devel/8.x/core/libs/imgqsort/detectors -I /home/gilles/Devel/8.x/core/libs/imgqsort -I /home/gilles/Devel/8.x/core/libs/iojobs -I /home/gilles/Devel/8.x/core/libs/jpegutils -I /home/gilles/Devel/8.x/core/libs/metadataengine/containers -I /home/gilles/Devel/8.x/core/libs/metadataengine/dmetadata -I /home/gilles/Devel/8.x/core/libs/metadataengine/engine -I /home/gilles/Devel/8.x/core/libs/metadataengine/exiftool -I /home/gilles/Devel/8.x/core/libs/metadataengine/focuspoint -I /home/gilles/Devel/8.x/core/libs/models -I /home/gilles/Devel/8.x/core/libs/networkmanager -I /home/gilles/Devel/8.x/core/libs/notificationmanager -I /home/gilles/Devel/8.x/core/libs/onlineversion -I /home/gilles/Devel/8.x/core/libs/pgfutils -I /home/gilles/Devel/8.x/core/libs/progressmanager -I /home/gilles/Devel/8.x/core/libs/properties/captions -I /home/gilles/Devel/8.x/core/libs/properties/geolocation -I /home/gilles/Devel/8.x/core/libs/properties/history -I /home/gilles/Devel/8.x/core/libs/properties/import -I /home/gilles/Devel/8.x/core/libs/properties -I /home/gilles/Devel/8.x/core/libs/rawengine -I /home/gilles/Devel/8.x/core/libs/settings -I /home/gilles/Devel/8.x/core/libs/tags/autoassignment -I /home/gilles/Devel/8.x/core/libs/tags/autoassignment/model -I /home/gilles/Devel/8.x/core/libs/tags/engine -I /home/gilles/Devel/8.x/core/libs/tags/manager/models -I /home/gilles/Devel/8.x/core/libs/tags/manager -I /home/gilles/Devel/8.x/core/libs/tags/widgets -I /home/gilles/Devel/8.x/core/libs/template -I /home/gilles/Devel/8.x/core/libs/threadimageio/engine -I /home/gilles/Devel/8.x/core/libs/threadimageio/fileio -I /home/gilles/Devel/8.x/core/libs/threadimageio/preview -I /home/gilles/Devel/8.x/core/libs/threadimageio/thumb -I /home/gilles/Devel/8.x/core/libs/threadimageio/video -I /home/gilles/Devel/8.x/core/libs/threads -I /home/gilles/Devel/8.x/core/libs/timeadjust -I /home/gilles/Devel/8.x/core/libs/transitionmngr -I /home/gilles/Devel/8.x/core/libs/versionmanager -I /home/gilles/Devel/8.x/core/libs/video -I /home/gilles/Devel/8.x/core/libs/video/manager -I /home/gilles/Devel/8.x/core/libs/video/osd -I /home/gilles/Devel/8.x/core/libs/video/player -I /home/gilles/Devel/8.x/core/libs/widgets/colors -I /home/gilles/Devel/8.x/core/libs/widgets/combo -I /home/gilles/Devel/8.x/core/libs/widgets/files -I /home/gilles/Devel/8.x/core/libs/widgets/fonts -I /home/gilles/Devel/8.x/core/libs/widgets/graphicsview -I /home/gilles/Devel/8.x/core/libs/widgets/history -I /home/gilles/Devel/8.x/core/libs/widgets/iccprofiles -I /home/gilles/Devel/8.x/core/libs/widgets/itemview -I /home/gilles/Devel/8.x/core/libs/widgets/layout -I /home/gilles/Devel/8.x/core/libs/widgets/mainview -I /home/gilles/Devel/8.x/core/libs/widgets/metadata/config -I /home/gilles/Devel/8.x/core/libs/widgets/metadata/exiftool -I /home/gilles/Devel/8.x/core/libs/widgets/metadata/exiv2 -I /home/gilles/Devel/8.x/core/libs/widgets/metadata/labels -I /home/gilles/Devel/8.x/core/libs/widgets/metadata/utils -I /home/gilles/Devel/8.x/core/libs/widgets/range -I /home/gilles/Devel/8.x/core/libs/widgets/text -I /home/gilles/Devel/8.x/core/libs/jpegutils/libjpeg/84 -I /home/gilles/Devel/8.x/core/app/utils -I /home/gilles/Devel/8.x/build.scan/core/app/utils -I /home/gilles/Devel/8.x/core/utilities/advancedrename -I /home/gilles/Devel/8.x/core/utilities/advancedrename/common -I /home/gilles/Devel/8.x/core/utilities/advancedrename/parser -I /home/gilles/Devel/8.x/core/utilities/advancedrename/parser/modifiers -I /home/gilles/Devel/8.x/core/utilities/advancedrename/parser/options -I /home/gilles/Devel/8.x/core/utilities/advancedrename/parser/options/database -I /home/gilles/Devel/8.x/core/utilities/advancedrename/parser/options/database/keys -I /home/gilles/Devel/8.x/core/utilities/extrasupport/addressbook -I /home/gilles/Devel/8.x/core/utilities/extrasupport/filesindexer -I /home/gilles/Devel/8.x/core/utilities/facemanagement/bench -I /home/gilles/Devel/8.x/core/utilities/facemanagement/database -I /home/gilles/Devel/8.x/core/utilities/facemanagement/dialogs -I /home/gilles/Devel/8.x/core/utilities/facemanagement/items -I /home/gilles/Devel/8.x/core/utilities/facemanagement/threads -I /home/gilles/Devel/8.x/core/utilities/facemanagement/widgets -I /home/gilles/Devel/8.x/core/utilities/facemanagement/workers -I /home/gilles/Devel/8.x/core/utilities/firstrun -I /home/gilles/Devel/8.x/core/utilities/focuspointmanagement -I /home/gilles/Devel/8.x/core/utilities/fuzzysearch -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/astro -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/blendings -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/core -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/geodata/data -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/geodata/graphicsitem -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/geodata/handlers/dgml -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/geodata/handlers/kml -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/geodata/parser -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/geodata/scene -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/geodata/writer -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/geodata/writers/dgml -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/geodata/writers/kml -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/graphicsview -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/layers -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/models -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/osm -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/render/atmosphere -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/render/compass -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/render/crosshairs -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/render/graticule -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/render/mapscale -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/render/measure -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/render/navigation -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/render/overviewmap -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/render/progress -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/cache -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/gpsbabel -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/gpx -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/gpx/handlers -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/json -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/kml -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/nominatim-reversegeocoding -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/osm -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/osm/o5mreader -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/osm/translators -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/osm/writers -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/pn2 -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/plugins/runner/pnt -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/projections -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/runners -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/settings -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/storage -I /home/gilles/Devel/8.x/core/utilities/geolocation/engine/tile -I /home/gilles/Devel/8.x/core/utilities/geolocation/geoiface/backends -I /home/gilles/Devel/8.x/core/utilities/geolocation/geoiface/bookmark -I /home/gilles/Devel/8.x/core/utilities/geolocation/geoiface/core -I /home/gilles/Devel/8.x/core/utilities/geolocation/geoiface/correlator -I /home/gilles/Devel/8.x/core/utilities/geolocation/geoiface/dragdrop -I /home/gilles/Devel/8.x/core/utilities/geolocation/geoiface/items -I /home/gilles/Devel/8.x/core/utilities/geolocation/geoiface/lookup -I /home/gilles/Devel/8.x/core/utilities/geolocation/geoiface/reversegeocoding -I /home/gilles/Devel/8.x/core/utilities/geolocation/geoiface/tiles -I /home/gilles/Devel/8.x/core/utilities/geolocation/geoiface/tracks -I /home/gilles/Devel/8.x/core/utilities/geolocation/geoiface/widgets -I /home/gilles/Devel/8.x/core/utilities/geolocation/geomapwrapper -I /home/gilles/Devel/8.x/core/utilities/geolocation/mapsearches -I /home/gilles/Devel/8.x/core/utilities/imageeditor/core -I /home/gilles/Devel/8.x/core/utilities/imageeditor/dialogs -I /home/gilles/Devel/8.x/core/utilities/imageeditor/editor -I /home/gilles/Devel/8.x/core/utilities/imageeditor/main -I /home/gilles/Devel/8.x/core/utilities/imageeditor/widgets -I /home/gilles/Devel/8.x/core/utilities/import/backend -I /home/gilles/Devel/8.x/core/utilities/import/dialogs -I /home/gilles/Devel/8.x/core/utilities/import/items -I /home/gilles/Devel/8.x/core/utilities/import/main -I /home/gilles/Devel/8.x/core/utilities/import/models -I /home/gilles/Devel/8.x/core/utilities/import/views -I /home/gilles/Devel/8.x/core/utilities/import/widgets -I /home/gilles/Devel/8.x/core/utilities/lighttable -I /home/gilles/Devel/8.x/core/utilities/maintenance/main -I /home/gilles/Devel/8.x/core/utilities/maintenance/manager -I /home/gilles/Devel/8.x/core/utilities/maintenance/tools/autotags -I /home/gilles/Devel/8.x/core/utilities/maintenance/tools/dbcleaner -I /home/gilles/Devel/8.x/core/utilities/maintenance/tools/dbscan -I /home/gilles/Devel/8.x/core/utilities/maintenance/tools/duplicates -I /home/gilles/Devel/8.x/core/utilities/maintenance/tools/facesmanagement -I /home/gilles/Devel/8.x/core/utilities/maintenance/tools/fingerprints -I /home/gilles/Devel/8.x/core/utilities/maintenance/tools/imgqsort -I /home/gilles/Devel/8.x/core/utilities/maintenance/tools/metaremover -I /home/gilles/Devel/8.x/core/utilities/maintenance/tools/metasync -I /home/gilles/Devel/8.x/core/utilities/maintenance/tools/thumbs -I /home/gilles/Devel/8.x/core/utilities/maintenance/utils -I /home/gilles/Devel/8.x/core/utilities/queuemanager/dplugins -I /home/gilles/Devel/8.x/core/utilities/queuemanager/main -I /home/gilles/Devel/8.x/core/utilities/queuemanager/manager -I /home/gilles/Devel/8.x/core/utilities/queuemanager/views -I /home/gilles/Devel/8.x/core/utilities/searchwindow -I /home/gilles/Devel/8.x/core/utilities/setup/album -I /home/gilles/Devel/8.x/core/utilities/setup/camera -I /home/gilles/Devel/8.x/core/utilities/setup/collections -I /home/gilles/Devel/8.x/core/utilities/setup/downloader -I /home/gilles/Devel/8.x/core/utilities/setup/editor -I /home/gilles/Devel/8.x/core/utilities/setup/metadata -I /home/gilles/Devel/8.x/core/utilities/setup/misc -I /home/gilles/Devel/8.x/core/utilities/setup -I /home/gilles/Devel/8.x/core/app/main -I /home/gilles/Devel/8.x/core/app/date -I /home/gilles/Devel/8.x/core/app/dragdrop -I /home/gilles/Devel/8.x/core/app/views/stack -I /home/gilles/Devel/8.x/core/app/views/utils -I /home/gilles/Devel/8.x/core/app/items/utils -I /home/gilles/Devel/8.x/core/app/items/delegate -I /home/gilles/Devel/8.x/core/app/views/sidebar -I /usr/include/opencv4 -I /usr/include/ImageMagick-6 -I /usr/include/aarch64-linux-gnu/ImageMagick-6 -I /opt/qt6/include/QtMultimedia -I /opt/qt6/include -I /opt/qt6/include/QtCore -I /opt/qt6/mkspecs/linux-g++ -I /opt/qt6/include/QtGui -I /opt/qt6/include/QtNetwork -I /opt/qt6/include/QtMultimediaWidgets -I /opt/qt6/include/QtWidgets -I /opt/qt6/include/QtXml -I /opt/qt6/include/QtSql -I /opt/qt6/include/QtConcurrent -I /opt/qt6/include/KF6/KConfig -I /opt/qt6/include/KF6/KConfigCore -I /opt/qt6/include/KF6/KI18n -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/13/../../../../include/c++/13 -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/13/../../../../include/aarch64-linux-gnu/c++/13 -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/13/../../../../include/c++/13/backward -internal-isystem /usr/lib/llvm-18/lib/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/include -internal-externc-isystem /usr/include/aarch64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-long-long -Wno-deprecated-copy -std=c++20 -fdeprecated-macro -ferror-limit 19 -fvisibility=hidden -fvisibility-inlines-hidden -fno-operator-names -fopenmp -fno-signed-char -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -analyzer-output=html -target-feature +outline-atomics -target-feature -fmv -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /mnt/data/Devel/8.x/project/reports/report.scan/2024-11-03-085830-479945-1 -x c++ /home/gilles/Devel/8.x/core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp
1/* ============================================================
2 *
3 * This file is a part of digiKam
4 *
5 * Date : 2019-08-08
6 * Description : Derived class to perform SSD neural network inference
7 * for face detection
8 *
9 * SPDX-FileCopyrightText: 2019 by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com>
10 * SPDX-FileCopyrightText: 2020-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#include "dnnfacedetectorssd.h"
17
18// Qt includes
19
20#include <QList>
21#include <QRect>
22#include <QString>
23#include <QFileInfo>
24#include <QMutexLocker>
25#include <QStandardPaths>
26
27// Local includes
28
29#include "digikam_debug.h"
30#include "digikam_config.h"
31#include "dnnmodelnet.h"
32#include "dnnmodelmanager.h"
33
34namespace Digikam
35{
36
37DNNFaceDetectorSSD::DNNFaceDetectorSSD()
38 : DNNFaceDetectorBase(1.0,
39 cv::Scalar(104.0, 177.0, 123.0),
40 cv::Size(300, 300))
41{
42 loadModels();
43}
44
45bool DNNFaceDetectorSSD::loadModels()
46{
47
48 model = DNNModelManager::instance()->getModel(QLatin1String("MobilenetSSD"), DNNModelUsage::DNNUsageFaceDetection);
49
50 if (model && !model->modelLoaded)
51 {
52 try
53 {
54 // NOTE This will throw an exception if the model can't be loaded.
55
56 cv::dnn::Net net = static_cast<DNNModelNet*>(model)->getNet();
57
58 qCDebug(DIGIKAM_FACEDB_LOG)for (QLoggingCategoryMacroHolder<QtDebugMsg> qt_category
((DIGIKAM_FACEDB_LOG)()); qt_category; qt_category.control = false
) QMessageLogger(static_cast<const char *>("/home/gilles/Devel/8.x/core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp"
), 58, static_cast<const char *>(__PRETTY_FUNCTION__), qt_category
.name()).debug()
<< "SSD model:" << model->info.displayName
59 << ", SSD data:" << model->info.configName;
60 }
61 catch (cv::Exception& e)
62 {
63 qCWarning(DIGIKAM_FACEDB_LOG)for (QLoggingCategoryMacroHolder<QtWarningMsg> qt_category
((DIGIKAM_FACEDB_LOG)()); qt_category; qt_category.control = false
) QMessageLogger(static_cast<const char *>("/home/gilles/Devel/8.x/core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp"
), 63, static_cast<const char *>(__PRETTY_FUNCTION__), qt_category
.name()).warning()
<< "cv::Exception:" << e.what();
64
65 return false;
66 }
67 catch (...)
68 {
69 qCWarning(DIGIKAM_FACEDB_LOG)for (QLoggingCategoryMacroHolder<QtWarningMsg> qt_category
((DIGIKAM_FACEDB_LOG)()); qt_category; qt_category.control = false
) QMessageLogger(static_cast<const char *>("/home/gilles/Devel/8.x/core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp"
), 69, static_cast<const char *>(__PRETTY_FUNCTION__), qt_category
.name()).warning()
<< "Default exception from OpenCV";
70
71 return false;
72 }
73 }
74
75 if (model && model->modelLoaded)
76 {
77 qCDebug(DIGIKAM_FACEDB_LOG)for (QLoggingCategoryMacroHolder<QtDebugMsg> qt_category
((DIGIKAM_FACEDB_LOG)()); qt_category; qt_category.control = false
) QMessageLogger(static_cast<const char *>("/home/gilles/Devel/8.x/core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp"
), 77, static_cast<const char *>(__PRETTY_FUNCTION__), qt_category
.name()).debug()
<< "SSD model:" << model->info.displayName << "ready";
78 }
79 else
80 {
81 qCWarning(DIGIKAM_FACEDB_LOG)for (QLoggingCategoryMacroHolder<QtWarningMsg> qt_category
((DIGIKAM_FACEDB_LOG)()); qt_category; qt_category.control = false
) QMessageLogger(static_cast<const char *>("/home/gilles/Devel/8.x/core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp"
), 81, static_cast<const char *>(__PRETTY_FUNCTION__), qt_category
.name()).warning()
<< "Face detection model: SSD not loaded";
82 return false;
83 }
84
85 return true;
86}
87
88void DNNFaceDetectorSSD::detectFaces(const cv::Mat& inputImage,
89 const cv::Size& paddedSize,
90 std::vector<cv::Rect>& detectedBboxes)
91{
92 if (inputImage.empty())
1
Assuming the condition is false
2
Taking false branch
93 {
94 qCDebug(DIGIKAM_FACESENGINE_LOG)for (QLoggingCategoryMacroHolder<QtDebugMsg> qt_category
((DIGIKAM_FACESENGINE_LOG)()); qt_category; qt_category.control
= false) QMessageLogger(static_cast<const char *>("/home/gilles/Devel/8.x/core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp"
), 94, static_cast<const char *>(__PRETTY_FUNCTION__), qt_category
.name()).debug()
<< "Invalid image given, not detecting faces.";
95 return;
96 }
97
98 cv::Mat detection;
99 cv::Mat inputBlob = cv::dnn::blobFromImage(inputImage, scaleFactor, inputImageSize, meanValToSubtract, true, false);
100
101 if (model && !static_cast<DNNModelNet*>(model)->getNet().empty())
3
Assuming field 'model' is null
102 {
103 QMutexLocker lock(&(model->mutex));
104 static_cast<DNNModelNet*>(model)->getNet().setInput(inputBlob);
105 detection = static_cast<DNNModelNet*>(model)->getNet().forward();
106 }
107 else
108 {
109 qCWarning(DIGIKAM_FACEDB_LOG)for (QLoggingCategoryMacroHolder<QtWarningMsg> qt_category
((DIGIKAM_FACEDB_LOG)()); qt_category; qt_category.control = false
) QMessageLogger(static_cast<const char *>("/home/gilles/Devel/8.x/core/libs/facesengine/detection/opencv-dnn/dnnfacedetectorssd.cpp"
), 109, static_cast<const char *>(__PRETTY_FUNCTION__),
qt_category.name()).warning()
<< "Face detection model: SSD not loaded. Processed 0 images.";
4
Loop condition is false. Execution continues on line 113
110 }
111
112
113 postprocess(detection, paddedSize, detectedBboxes);
5
Calling 'DNNFaceDetectorSSD::postprocess'
114}
115
116void DNNFaceDetectorSSD::postprocess(cv::Mat detection,
117 const cv::Size& paddedSize,
118 std::vector<cv::Rect>& detectedBboxes) const
119{
120 std::vector<float> goodConfidences, doubtConfidences, confidences;
121 std::vector<cv::Rect> goodBoxes, doubtBoxes, boxes;
122
123 cv::Mat detectionMat(detection.size[2], detection.size[3], CV_32F5, detection.ptr<float>());
124
125 const float confidenceThreshold = model->getThreshold(uiConfidenceThreshold);
6
Called C++ object pointer is null
126
127 // TODO: model problem, confidence of ssd output too low ==> false detection.
128
129 for (int i = 0 ; i < detectionMat.rows ; ++i)
130 {
131 float confidence = detectionMat.at<float>(i, 2);
132
133 if (confidence > confidenceThreshold)
134 {
135 float leftRatio = detectionMat.at<float>(i, 3);
136 float topRatio = detectionMat.at<float>(i, 4);
137 float rightRatio = detectionMat.at<float>(i, 5);
138 float bottomRatio = detectionMat.at<float>(i, 6);
139
140 int left = (int)(leftRatio * inputImageSize.width);
141 int right = (int)(rightRatio * inputImageSize.width);
142 int top = (int)(topRatio * inputImageSize.height);
143 int bottom = (int)(bottomRatio * inputImageSize.height);
144
145 selectBbox(paddedSize,
146 confidence,
147 left,
148 right,
149 top,
150 bottom,
151 goodConfidences,
152 goodBoxes,
153 doubtConfidences,
154 doubtBoxes);
155 }
156 }
157/*
158 qCDebug(DIGIKAM_FACESENGINE_LOG) << "nb of doubtbox = " << doubtBoxes.size();
159 qCDebug(DIGIKAM_FACESENGINE_LOG) << "nb of goodbox = " << goodBoxes.size();
160*/
161 if (goodBoxes.empty())
162 {
163 boxes = doubtBoxes;
164 confidences = doubtConfidences;
165 }
166 else
167 {
168 boxes = goodBoxes;
169 confidences = goodConfidences;
170 }
171
172 // Perform non maximum suppression to eliminate redundant overlapping boxes with lower confidences.
173
174 std::vector<int> indices;
175 cv::dnn::NMSBoxes(boxes, confidences, confidenceThreshold, nmsThreshold, indices);
176
177 // Get detected bounding boxes.
178
179 for (size_t i = 0 ; i < indices.size() ; ++i)
180 {
181 cv::Rect bbox = boxes[indices[i]];
182 correctBbox(bbox, paddedSize);
183 detectedBboxes.push_back(cv::Rect(bbox.x, bbox.y, bbox.width, bbox.height));
184 }
185}
186
187} // namespace Digikam