The BrightSign OpenCV 4.5.5 build is missing the cv2.dnn.DictValue class, causing failures when testing YOLOX and other deep learning functionality:
# python3 /storage/sd/python-init/test_cv2_dnn.py
Testing cv2.dnn module availability...
❌ Attribute error: module 'cv2.dnn' has no attribute 'DictValue'
cv2.dnn.DictValueis a utility class in OpenCV's DNN module used for handling parameter dictionaries- It's part of the core DNN API and should be available when DNN module is properly compiled
- The class is used internally by various DNN functions and is expected by opencv-python compatibility
- OpenCV recipe (
bsoe-recipes/meta-bs/recipes-open/opencv/opencv_4.5.5.bb) has:- DNN enabled in PACKAGECONFIG (line 108)
- Proper DNN build flags:
-DBUILD_opencv_dnn=ON -DPROTOBUF_UPDATE_FILES=ON -DBUILD_PROTOBUF=OFF - Dependencies: protobuf, protobuf-native, python3-protobuf
- opencv_contrib modules included
- BrightSign SDK includes both opencv and python3-opencv packages
- Protobuf recipe exists and looks properly configured
-
Python Binding Generation Failure
- Cross-compilation issues preventing proper Python wrapper generation for DictValue
- Missing or incomplete binding code generation during build
-
Partial DNN Module Compilation
- DNN module compiles but missing certain components/classes
- Build warnings/errors during DNN compilation that don't fail the overall build
-
Protobuf Version Compatibility
- OpenCV 4.5.5 expecting different protobuf version than 3.20.3
- Protobuf not properly linked during DNN module compilation
-
Contrib Module Integration Issues
- DictValue might be in contrib modules that aren't properly integrated
- Missing opencv_contrib components during build
-
Cross-Compilation Artifacts
- ARM64 target compilation missing x86_64 build dependencies
- Missing build-time protobuf components needed for binding generation
-
Extract and Examine Current SDK
./build --extract-sdk ./brightsign-x*.sh -d ./sdk -y- Inspect OpenCV Python bindings in sdk/
- Check if libopencv_dnn exists and is properly linked
- Verify protobuf libraries are present
-
Test Individual OpenCV Build
./build --clean opencv ./build opencv 2>&1 | tee opencv_build.log
- Look for DNN compilation warnings/errors
- Check if Python binding generation logs show DictValue issues
-
Examine Build Logs
- Use docker exec to access build container logs
- Check
/home/builder/bsoe/brightsign-oe/build/tmp-glibc/work/*/temp/log.*for opencv build - Look for protobuf-related errors or DNN compilation issues
-
Check OpenCV Source
- Examine
/home/scott/workspace/Brightsign/brightsign-npu-yolo-extension/brightsign-oefor DictValue references - Verify DictValue exists in the OpenCV 4.5.5 source code
- Check if contrib modules are properly included
- Examine
-
Python Binding Investigation
- Look for cv2.cpp or similar binding files in build output
- Check if DictValue binding code is generated
- Compare with reference OpenCV builds
-
Protobuf Integration Test
./build python3-protobuf
- Ensure protobuf builds cleanly
- Verify protobuf-native is available for build-time usage
-
Check CMake Configuration
- Examine CMakeCache.txt in opencv build directory
- Verify PROTOBUF_FOUND and related variables
- Check if DNN module is actually enabled in cmake
-
Add Explicit DNN Verification
# Add to opencv recipe EXTRA_OECMAKE += "-DBUILD_opencv_dnn=ON \ -DOPENCV_DNN_OPENCL=OFF \ -DWITH_PROTOBUF=ON \ -DPROTOBUF_UPDATE_FILES=ON"
-
Enhance Python Binding Generation
# Ensure Python bindings include all DNN components PACKAGECONFIG[python3] = "-DPYTHON3_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include \ -DBUILD_opencv_python3=ON \ -DPYTHON3_INCLUDE_DIR=${STAGING_INCDIR}/python3.8 \ -DPYTHON3_LIBRARY=${STAGING_LIBDIR}/libpython3.8.so,,python3-numpy,"
- Update Protobuf Version
- Check if OpenCV 4.5.5 needs newer protobuf
- Update python3-protobuf recipe if needed
- Create OpenCV DNN Patch
- If DictValue binding is missing from source, create patch to add it
- Add to opencv/files/ directory
- Add Build-time Verification
do_compile:append() { # Verify DNN module compiled properly if [ ! -f ${WORKDIR}/build/lib/libopencv_dnn.so ]; then bbfatal "OpenCV DNN module failed to compile" fi } do_install:append() { # Verify Python bindings include DictValue ${STAGING_BINDIR_NATIVE}/python3 -c "import cv2.dnn; cv2.dnn.DictValue()" || bbfatal "DictValue not found in Python bindings" }
-
Build Test Sequence
./build --clean opencv ./build opencv ./build --extract-sdk ./brightsign-x*.sh -d ./sdk -y -
SDK Verification
- Test DictValue availability in extracted SDK
- Run comprehensive cv2.dnn tests
- Verify YOLOX compatibility
-
Player Testing
- Deploy to BrightSign player
- Run test_cv2_dnn.py
- Validate full YOLOX pipeline
cv2.dnn.DictValueavailable in Python bindings- Full cv2.dnn module functionality restored
- YOLOX and other DNN frameworks working properly
- Clean build with no DNN-related warnings/errors
If fixes cause build failures:
- Revert to original opencv recipe
- Try alternative approaches (different protobuf version, minimal patches)
- Consider building DictValue as separate component if absolutely necessary
- Phase 1 (Diagnostics): 2-3 hours
- Phase 2 (Analysis): 1-2 hours
- Phase 3 (Dependencies): 1 hour
- Phase 4 (Implementation): 2-4 hours (depending on fix complexity)
- Phase 5 (Testing): 2-3 hours
- Total: 8-13 hours
- ✅
python3 -c "import cv2.dnn; print(cv2.dnn.DictValue())"works in SDK - ✅ test_cv2_dnn.py passes all tests on BrightSign player
- ✅ YOLOX pipeline functional end-to-end
- ✅ Clean build logs with no DNN-related errors
- ✅ All existing OpenCV functionality still working