Implement Nuclio serverless function for CVAT integration with AOC Fruit Detector #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a complete nuclio serverless function that wraps the AOC fruit detector for seamless integration with CVAT (Computer Vision Annotation Tool). The solution enables automatic fruit detection and annotation in CVAT workflows while maintaining the existing ROS2-based fruit detector architecture.
Architecture Overview
The implementation follows a two-container design:
Communication Flow
Key Components
Core Implementation (
nuclio_function/
)main.py
: Main nuclio function handler implementing CVAT-compatible HTTP interfaceros2_bridge.py
: ROS2 communication bridge managing image publishing and result subscriptioncvat_converter.py
: Converter transforming AOCFruitInfoArray
messages to CVAT annotation formatDockerfile
: Multi-stage container build for nuclio deploymentDeployment Infrastructure
function.yaml
: Nuclio function configuration with resource limits and triggersdeploy.sh
: Automated deployment script for Kubernetes/Docker environmentsdocker-compose.yml
: Local development environment setupTesting & Validation
validate.py
: Syntax and logic validation without ROS2 dependenciestest_function.py
: End-to-end integration testing with visualizationhealth_check.py
: Production health monitoring utilityDocumentation & Examples
README.md
: Comprehensive deployment and usage instructionsCVAT_INTEGRATION.md
: Step-by-step CVAT integration guidecvat_model_config.json
: Example CVAT model configurationIMPLEMENTATION_SUMMARY.md
: Technical architecture documentationMessage Format Handling
The implementation correctly processes the rich AOC message structure:
Key Features
✅ Serverless Architecture: Production-ready nuclio function with auto-scaling
✅ ROS2 Integration: Uses
/camera/image_raw
and/fruit_info
topics as specified✅ Rich Metadata: Preserves all AOC detection attributes in CVAT format
✅ Error Handling: Robust timeout management and graceful degradation
✅ Development Support: Mock classes and validation for testing without ROS2
✅ Documentation: Complete deployment guides and integration examples
Usage
Deployment
cd nuclio_function ./deploy.sh
CVAT Integration
Testing
Compliance with Requirements
/camera/image_raw
→/fruit_info
topicsFruitInfoArray
andFruitInfoMessage
structuresThis implementation provides a production-ready bridge between the AOC fruit detector and CVAT, enabling seamless automatic annotation workflows for agricultural computer vision tasks.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.