Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/KeywordTagging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ project(KeywordTagging)
set(CMAKE_CXX_STANDARD 17)
include(../ComponentSetup.cmake)

find_package(OpenCV 4.9.0 EXACT REQUIRED PATHS /opt/opencv-4.9.0 COMPONENTS opencv_core)
find_package(OpenCV 4.13.0 EXACT REQUIRED PATHS /opt/opencv-4.13.0 COMPONENTS opencv_core)

find_package(mpfComponentInterface REQUIRED)
find_package(mpfDetectionComponentApi REQUIRED)
Expand Down
12 changes: 6 additions & 6 deletions cpp/KeywordTagging/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.2
# syntax=docker/dockerfile:1.20

#############################################################################
# NOTICE #
Expand Down Expand Up @@ -28,10 +28,10 @@

ARG BUILD_REGISTRY
ARG BUILD_TAG=latest
FROM ${BUILD_REGISTRY}openmpf_cpp_component_build:${BUILD_TAG} as build_component
FROM ${BUILD_REGISTRY}openmpf_cpp_component_build:${BUILD_TAG} AS build_component

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8

RUN --mount=type=tmpfs,target=/var/cache/apt \
--mount=type=tmpfs,target=/var/lib/apt/lists \
Expand All @@ -45,9 +45,9 @@ ARG RUN_TESTS=false
RUN if [ "${RUN_TESTS,,}" == true ]; then cd $BUILD_DIR/test && ./KeywordTaggingTest; fi


FROM ${BUILD_REGISTRY}openmpf_cpp_executor:${BUILD_TAG} as install_component
FROM ${BUILD_REGISTRY}openmpf_cpp_executor:${BUILD_TAG} AS install_component

ENV LD_LIBRARY_PATH $PLUGINS_DIR/KeywordTagging/lib
ENV LD_LIBRARY_PATH=$PLUGINS_DIR/KeywordTagging/lib

COPY --from=build_component $BUILD_DIR/plugin/KeywordTagging \
$PLUGINS_DIR/KeywordTagging
Expand Down
16 changes: 8 additions & 8 deletions cpp/KeywordTagging/KeywordTagging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void KeywordTagging::load_tags_json(const MPFJob &job, map<wstring, vector<pair<

string plugin_path = run_dir + "/KeywordTagging";

LOG4CXX_DEBUG(hw_logger_, "Running from directory " + plugin_path)
LOG4CXX_DEBUG(hw_logger_, "Running from directory " + plugin_path);

string jsonfile_path = DetectionComponentUtils::GetProperty<string>(job.job_properties, "TAGGING_FILE",
"text-tags.json");
Expand All @@ -339,9 +339,9 @@ void KeywordTagging::load_tags_json(const MPFJob &job, map<wstring, vector<pair<
jsonfile_path = plugin_path + "/config/" + jsonfile_path;
}

LOG4CXX_DEBUG(hw_logger_, "About to read JSON from: " + jsonfile_path)
LOG4CXX_DEBUG(hw_logger_, "About to read JSON from: " + jsonfile_path);
json_kvs_regex = parse_json(job, jsonfile_path);
LOG4CXX_DEBUG(hw_logger_, "Read JSON")
LOG4CXX_DEBUG(hw_logger_, "Read JSON");
}

bool is_only_ascii_whitespace(const wstring &str) {
Expand Down Expand Up @@ -491,15 +491,15 @@ bool KeywordTagging::get_text_to_process(const MPFJob &job, const Properties &de
for (string prop_to_process : split_props_to_process) {
boost::trim(prop_to_process);
if (detection_properties.find(prop_to_process) != detection_properties.end()) {
LOG4CXX_INFO(hw_logger_, "Performing tagging on " + prop_to_process + " property.")
LOG4CXX_INFO(hw_logger_, "Performing tagging on " + prop_to_process + " property.");
text = boost::locale::conv::utf_to_utf<wchar_t>(detection_properties.at(prop_to_process));
prop_texts[prop_to_process] = text;
has_prop = true;
}
}

if (!has_prop) {
LOG4CXX_WARN(hw_logger_, "Feed forward element missing one of the following properties: " + props_to_process)
LOG4CXX_WARN(hw_logger_, "Feed forward element missing one of the following properties: " + props_to_process);
}

return has_prop;
Expand All @@ -519,13 +519,13 @@ void KeywordTagging::process_text_tagging(Properties &detection_properties, cons
prop_text = it.second;

LOG4CXX_DEBUG(hw_logger_, "Processing tags on " +
boost::locale::conv::utf_to_utf<char>(prop))
boost::locale::conv::utf_to_utf<char>(prop));
LOG4CXX_DEBUG(hw_logger_, "Text is: " +
boost::locale::conv::utf_to_utf<char>(prop_text))
boost::locale::conv::utf_to_utf<char>(prop_text));

if (is_only_ascii_whitespace(prop_text)) {
LOG4CXX_WARN(hw_logger_, "No text to process for " +
boost::locale::conv::utf_to_utf<char>(prop))
boost::locale::conv::utf_to_utf<char>(prop));
continue;
}
has_text = true;
Expand Down
2 changes: 1 addition & 1 deletion cpp/OalprLicensePlateTextDetection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(CMAKE_CXX_STANDARD 17)

include(../ComponentSetup.cmake)

find_package(OpenCV 4.9.0 EXACT REQUIRED PATHS /opt/opencv-4.9.0 COMPONENTS opencv_core)
find_package(OpenCV 4.13.0 EXACT REQUIRED PATHS /opt/opencv-4.13.0 COMPONENTS opencv_core)
find_package(mpfComponentInterface REQUIRED)
find_package(mpfDetectionComponentApi REQUIRED)
find_package(mpfComponentUtils REQUIRED)
Expand Down
8 changes: 4 additions & 4 deletions cpp/OalprLicensePlateTextDetection/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.2
# syntax=docker/dockerfile:1.20

#############################################################################
# NOTICE #
Expand Down Expand Up @@ -28,7 +28,7 @@

ARG BUILD_REGISTRY
ARG BUILD_TAG=latest
FROM ${BUILD_REGISTRY}openmpf_cpp_component_build:${BUILD_TAG} as build_component
FROM ${BUILD_REGISTRY}openmpf_cpp_component_build:${BUILD_TAG} AS build_component

RUN --mount=type=tmpfs,target=/var/cache/apt \
--mount=type=tmpfs,target=/var/lib/apt/lists \
Expand Down Expand Up @@ -83,9 +83,9 @@ RUN if [ "${RUN_TESTS,,}" == true ]; then \
fi


FROM ${BUILD_REGISTRY}openmpf_cpp_executor:${BUILD_TAG} as install_component
FROM ${BUILD_REGISTRY}openmpf_cpp_executor:${BUILD_TAG} AS install_component

ENV LD_LIBRARY_PATH $PLUGINS_DIR/OalprLicensePlateTextDetection/lib
ENV LD_LIBRARY_PATH=$PLUGINS_DIR/OalprLicensePlateTextDetection/lib

COPY --from=build_component $BUILD_DIR/plugin/OalprLicensePlateTextDetection \
$PLUGINS_DIR/OalprLicensePlateTextDetection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ int main(int argc, char* argv[]) {

// set up logger
log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger("logger");
log4cxx::SimpleLayoutPtr layout = new log4cxx::SimpleLayout();
log4cxx::ConsoleAppenderPtr console_appender =
new log4cxx::ConsoleAppender(layout);
log4cxx::SimpleLayoutPtr layout{new log4cxx::SimpleLayout()};
log4cxx::ConsoleAppenderPtr console_appender{
new log4cxx::ConsoleAppender(layout)};
logger->addAppender(console_appender);
logger->setLevel(log4cxx::Level::getDebug());

Expand Down
2 changes: 1 addition & 1 deletion cpp/OcvDnnDetection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(CMAKE_CXX_STANDARD 17)

include(../ComponentSetup.cmake)

find_package(OpenCV 4.9.0 EXACT REQUIRED PATHS /opt/opencv-4.9.0
find_package(OpenCV 4.13.0 EXACT REQUIRED PATHS /opt/opencv-4.13.0
COMPONENTS opencv_dnn)

find_package(mpfComponentInterface REQUIRED)
Expand Down
23 changes: 14 additions & 9 deletions cpp/OcvDnnDetection/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.2
# syntax=docker/dockerfile:1.20

#############################################################################
# NOTICE #
Expand Down Expand Up @@ -28,25 +28,30 @@

ARG BUILD_REGISTRY
ARG BUILD_TAG=latest
FROM ${BUILD_REGISTRY}openmpf_cpp_component_build:${BUILD_TAG} as build_component
FROM ${BUILD_REGISTRY}openmpf_cpp_component_build:${BUILD_TAG} AS build_component

RUN --mount=target=. build-component.sh

ARG RUN_TESTS=false
RUN if [ "${RUN_TESTS,,}" == true ]; then cd $BUILD_DIR/test && ./OcvDnnDetectionTest; fi


FROM ${BUILD_REGISTRY}openmpf_cpp_executor:${BUILD_TAG} as ocv_dnn_component
FROM ${BUILD_REGISTRY}openmpf_cpp_executor:${BUILD_TAG} AS ocv_dnn_component

COPY --from=build_component /usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8 /usr/lib/x86_64-linux-gnu/

COPY --from=build_component /usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8 /usr/lib/x86_64-linux-gnu/
COPY --from=build_component \
/usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.19.0 \
/usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.19.0 \
/usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.19.0 \
/usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.19.0 \
/usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.19.0 \
/usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.19.0 \
/usr/lib/x86_64-linux-gnu/

COPY --from=build_component $BUILD_DIR/plugin/OcvDnnDetection $PLUGINS_DIR/OcvDnnDetection

COPY --from=build_component $BUILD_DIR/libmpfOcvDnnDetection.so $PLUGINS_DIR/OcvDnnDetection/lib/

ENV LD_LIBRARY_PATH $PLUGINS_DIR/OcvDnnDetection/lib
ENV LD_LIBRARY_PATH=$PLUGINS_DIR/OcvDnnDetection/lib

LABEL org.label-schema.license="Mixed" \
org.label-schema.name="OpenMPF OpenCV Deep Neural Network (DNN) Classification" \
Expand All @@ -56,15 +61,15 @@ LABEL org.label-schema.license="Mixed" \
org.label-schema.vendor="MITRE"


FROM ocv_dnn_component as sample_executable
FROM ocv_dnn_component AS sample_executable

COPY --from=build_component $BUILD_DIR/sample_ocv_dnn_classifier /opt/mpf/

COPY --from=build_component $BUILD_DIR/test/data /opt/mpf/test-data

RUN ln -s /opt/mpf/plugins /opt/mpf/plugin

ENV LD_LIBRARY_PATH $PLUGINS_DIR/OcvDnnDetection/lib
ENV LD_LIBRARY_PATH=$PLUGINS_DIR/OcvDnnDetection/lib

ENTRYPOINT ["/opt/mpf/sample_ocv_dnn_classifier"]

Expand Down
2 changes: 1 addition & 1 deletion cpp/OcvDnnDetection/OcvDnnDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ bool OcvDnnDetection::Init() {
.RegisterPathField("synset_txt", &ModelSettings::synset_file);
}
catch (const std::exception &ex) {
LOG4CXX_ERROR(logger_, "Failed to initialize ModelsIniParser due to: " << ex.what())
LOG4CXX_ERROR(logger_, "Failed to initialize ModelsIniParser due to: " << ex.what());
return false;
}

Expand Down
3 changes: 1 addition & 2 deletions cpp/OcvFaceDetection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(CMAKE_CXX_STANDARD 17)

include(../ComponentSetup.cmake)

find_package(OpenCV 4.9.0 EXACT REQUIRED PATHS /opt/opencv-4.9.0
find_package(OpenCV 4.13.0 EXACT REQUIRED PATHS /opt/opencv-4.13.0
COMPONENTS opencv_highgui opencv_objdetect opencv_features2d opencv_ml opencv_flann opencv_video)

find_package(mpfComponentInterface REQUIRED)
Expand All @@ -55,4 +55,3 @@ add_subdirectory(test)

add_executable(sample_ocv_face_detector sample_ocv_face_detector.cpp)
target_link_libraries(sample_ocv_face_detector mpfOcvFaceDetection)

8 changes: 4 additions & 4 deletions cpp/OcvFaceDetection/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.2
# syntax=docker/dockerfile:1.20

#############################################################################
# NOTICE #
Expand Down Expand Up @@ -28,7 +28,7 @@

ARG BUILD_REGISTRY
ARG BUILD_TAG=latest
FROM ${BUILD_REGISTRY}openmpf_cpp_component_build:${BUILD_TAG} as build_component
FROM ${BUILD_REGISTRY}openmpf_cpp_component_build:${BUILD_TAG} AS build_component

RUN --mount=target=. build-component.sh

Expand All @@ -37,9 +37,9 @@ RUN if [ "${RUN_TESTS,,}" == true ]; then cd $BUILD_DIR/test && ./OcvFaceDetecti



FROM ${BUILD_REGISTRY}openmpf_cpp_executor:${BUILD_TAG} as install_component
FROM ${BUILD_REGISTRY}openmpf_cpp_executor:${BUILD_TAG} AS install_component

ENV LD_LIBRARY_PATH $PLUGINS_DIR/OcvFaceDetection/lib
ENV LD_LIBRARY_PATH=$PLUGINS_DIR/OcvFaceDetection/lib

COPY --from=build_component $BUILD_DIR/plugin/OcvFaceDetection $PLUGINS_DIR/OcvFaceDetection

Expand Down
2 changes: 1 addition & 1 deletion cpp/OcvYoloDetection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ set(DLIB_DIR /apps/source/dlib-sources/dlib-19.20/dlib)
include(${DLIB_DIR}/cmake)
set_property(TARGET dlib PROPERTY POSITION_INDEPENDENT_CODE ON)

find_package(OpenCV 4.9.0 EXACT REQUIRED COMPONENTS opencv_dnn opencv_videoio opencv_tracking)
find_package(OpenCV 4.13.0 EXACT REQUIRED COMPONENTS opencv_dnn opencv_videoio opencv_tracking)

find_package(mpfComponentInterface REQUIRED)
find_package(mpfDetectionComponentApi REQUIRED)
Expand Down
12 changes: 6 additions & 6 deletions cpp/OcvYoloDetection/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
#define LOG_PREFIX ""
#endif

#define LOG_TRACE(MSG){ LOG4CXX_TRACE(Config::log, LOG_PREFIX << MSG) }
#define LOG_DEBUG(MSG){ LOG4CXX_DEBUG(Config::log, LOG_PREFIX << MSG) }
#define LOG_INFO(MSG){ LOG4CXX_INFO (Config::log, LOG_PREFIX << MSG) }
#define LOG_WARN(MSG){ LOG4CXX_WARN (Config::log, LOG_PREFIX << MSG) }
#define LOG_ERROR(MSG){ LOG4CXX_ERROR(Config::log, LOG_PREFIX << MSG) }
#define LOG_FATAL(MSG){ LOG4CXX_FATAL(Config::log, LOG_PREFIX << MSG) }
#define LOG_TRACE(MSG){ LOG4CXX_TRACE(Config::log, LOG_PREFIX << MSG); }
#define LOG_DEBUG(MSG){ LOG4CXX_DEBUG(Config::log, LOG_PREFIX << MSG); }
#define LOG_INFO(MSG){ LOG4CXX_INFO (Config::log, LOG_PREFIX << MSG); }
#define LOG_WARN(MSG){ LOG4CXX_WARN (Config::log, LOG_PREFIX << MSG); }
#define LOG_ERROR(MSG){ LOG4CXX_ERROR(Config::log, LOG_PREFIX << MSG); }
#define LOG_FATAL(MSG){ LOG4CXX_FATAL(Config::log, LOG_PREFIX << MSG); }


class Config {
Expand Down
24 changes: 14 additions & 10 deletions cpp/OcvYoloDetection/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax=docker/dockerfile:1.2
# syntax=docker/dockerfile:1.20

#############################################################################
# NOTICE #
Expand Down Expand Up @@ -30,13 +30,13 @@ ARG BUILD_REGISTRY
ARG BUILD_TAG=latest

# Download weights in separate stage so they don't need to be re-downloaded when base images change.
FROM ubuntu:20.04 as download_dependencies
FROM ubuntu:24.04 AS download_dependencies

RUN --mount=type=tmpfs,target=/var/cache/apt \
--mount=type=tmpfs,target=/var/lib/apt/lists \
--mount=type=tmpfs,target=/tmp \
apt-get update; \
apt-get install --no-install-recommends -y wget ca-certificates;
apt-get install --no-install-recommends -y wget ca-certificates bzip2;

RUN mkdir /weights \
&& cd /weights \
Expand All @@ -49,12 +49,11 @@ RUN mkdir --parents /apps/source/dlib-sources; \


RUN mkdir /opt/triton \
&& wget -O- https://github.com/triton-inference-server/server/releases/download/v2.11.0/v2.11.0_ubuntu2004.clients.tar.gz \
&& wget -O- https://github.com/triton-inference-server/server/releases/download/v2.55.0/v2.55.0_ubuntu2404.clients.tar.gz \
| tar --extract --gzip --directory /opt/triton lib include



FROM ${BUILD_REGISTRY}openmpf_cpp_component_build:${BUILD_TAG} as build_component
FROM ${BUILD_REGISTRY}openmpf_cpp_component_build:${BUILD_TAG} AS build_component

ENV TRITON_SUPPORT=ON

Expand All @@ -78,19 +77,24 @@ RUN --mount=target=. \
fi


FROM ${BUILD_REGISTRY}openmpf_cpp_executor:${BUILD_TAG} as install_component
FROM ${BUILD_REGISTRY}openmpf_cpp_executor:${BUILD_TAG} AS install_component

COPY --from=download_dependencies /weights $PLUGINS_DIR/OcvYoloDetection/models

COPY --from=build_component /usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8 /usr/lib/x86_64-linux-gnu/
COPY --from=build_component \
/usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9 \
/usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9 \
/usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9 \
/usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9 \
/usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9 \
/usr/lib/x86_64-linux-gnu/

COPY --from=build_component /usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8 /usr/lib/x86_64-linux-gnu/

COPY --from=build_component $BUILD_DIR/plugin/OcvYoloDetection $PLUGINS_DIR/OcvYoloDetection

COPY --from=build_component $BUILD_DIR/libmpfOcvYoloDetection.so $PLUGINS_DIR/OcvYoloDetection/lib/

ENV LD_LIBRARY_PATH $PLUGINS_DIR/OcvYoloDetection/lib
ENV LD_LIBRARY_PATH=$PLUGINS_DIR/OcvYoloDetection/lib

LABEL org.label-schema.license="Mixed" \
org.label-schema.name="OpenMPF OpenCV Yolo Detection" \
Expand Down
2 changes: 1 addition & 1 deletion cpp/OcvYoloDetection/yolo_network/BaseYoloNetworkImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace {

std::string message = "An error occurred while trying to set CUDA device: " + ex.msg;
if (config.fallback2CpuWhenGpuProblem) {
LOG4CXX_WARN(log, message << ". Job will run on CPU instead.")
LOG4CXX_WARN(log, message << ". Job will run on CPU instead.");
return -1;
} else {
throw MPFDetectionException(MPFDetectionError::MPF_GPU_ERROR, message);
Expand Down
2 changes: 1 addition & 1 deletion cpp/SceneChangeDetection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ set(CMAKE_CXX_STANDARD 17)

include(../ComponentSetup.cmake)

find_package(OpenCV 4.9.0 EXACT REQUIRED PATHS /opt/opencv-4.9.0
find_package(OpenCV 4.13.0 EXACT REQUIRED PATHS /opt/opencv-4.13.0
COMPONENTS opencv_video opencv_highgui)

find_package(mpfComponentInterface REQUIRED)
Expand Down
Loading