
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
matrice-analytics
Advanced tools
This module provides a comprehensive, refactored post-processing system for the Matrice Python SDK. The system has been completely redesigned to be more pythonic, maintainable, and extensible while providing powerful analytics capabilities for various use cases.
PostProcessor class handles all processing needsProcessingResult objectsProcessingResult objectspost_processing/
├── __init__.py # Main exports and convenience functions
├── processor.py # Main PostProcessor class
├── README.md # This documentation
│
├── core/ # Core system components
│ ├── __init__.py
│ ├── base.py # Base classes, enums, and protocols
│ ├── config.py # Configuration system
│ └── advanced_usecases.py # Advanced use case implementations
│
├── usecases/ # Separate use case implementations
│ ├── __init__.py
│ ├── people_counting.py # People counting use case
│ └── customer_service.py # Customer service use case
│
└── utils/ # Utility functions organized by category
├── __init__.py
├── geometry_utils.py # Geometric calculations
├── format_utils.py # Format detection and conversion
├── filter_utils.py # Filtering and cleaning operations
├── counting_utils.py # Counting and aggregation
└── tracking_utils.py # Tracking and movement analysis
from matrice_analytics.post_processing import PostProcessor, process_simple
# Method 1: Simple processing (recommended for quick tasks)
result = process_simple(
raw_results,
usecase="people_counting",
confidence_threshold=0.5
)
# Method 2: Using PostProcessor class (recommended for complex workflows)
processor = PostProcessor()
result = processor.process_simple(
raw_results,
usecase="people_counting",
confidence_threshold=0.5,
enable_tracking=True
)
print(f"Status: {result.status.value}")
print(f"Summary: {result.summary}")
print(f"Insights: {len(result.insights)} generated")
# Create complex configuration
config = processor.create_config(
'people_counting',
confidence_threshold=0.6,
enable_tracking=True,
person_categories=['person', 'people', 'human'],
zone_config={
'zones': {
'entrance': [[0, 0], [100, 0], [100, 100], [0, 100]],
'checkout': [[200, 200], [300, 200], [300, 300], [200, 300]]
}
},
alert_config={
'count_thresholds': {'all': 10},
'occupancy_thresholds': {'entrance': 5}
}
)
# Process with configuration
result = processor.process(raw_results, config)
# Save configuration to file
processor.save_config(config, "people_counting_config.json")
# Load and use configuration from file
result = processor.process_from_file(raw_results, "people_counting_config.json")
people_counting)Advanced people counting with comprehensive analytics:
result = process_simple(
raw_results,
usecase="people_counting",
confidence_threshold=0.5,
enable_tracking=True,
person_categories=['person', 'people'],
zone_config={
'zones': {
'entrance': [[0, 0], [100, 0], [100, 100], [0, 100]]
}
}
)
Features:
customer_service)Comprehensive customer service analytics:
result = process_simple(
raw_results,
usecase="customer_service",
confidence_threshold=0.6,
service_proximity_threshold=50.0,
staff_categories=['staff', 'employee'],
customer_categories=['customer', 'person']
)
Features:
All configurations are type-safe dataclasses with built-in validation:
from matrice_analytics.post_processing import PeopleCountingConfig, ZoneConfig
# Create configuration programmatically
config = PeopleCountingConfig(
confidence_threshold=0.5,
enable_tracking=True,
zone_config=ZoneConfig(
zones={
'entrance': [[0, 0], [100, 0], [100, 100], [0, 100]]
}
)
)
# Validate configuration
errors = config.validate()
if errors:
print(f"Configuration errors: {errors}")
# Get configuration template for a use case
template = processor.get_config_template('people_counting')
print(f"Available options: {list(template.keys())}")
# List all available use cases
use_cases = processor.list_available_usecases()
print(f"Available use cases: {use_cases}")
All processing operations return a standardized ProcessingResult object:
class ProcessingResult:
data: Any # Processed data
status: ProcessingStatus # SUCCESS, ERROR, WARNING, PARTIAL
usecase: str # Use case name
category: str # Use case category
processing_time: float # Processing time in seconds
summary: str # Human-readable summary
insights: List[str] # Generated insights
warnings: List[str] # Warning messages
error_message: Optional[str] # Error message if failed
predictions: List[Dict[str, Any]] # Detailed predictions
metrics: Dict[str, Any] # Performance metrics
result = processor.process_simple(data, "people_counting")
# Check status
if result.is_success():
print(f"✅ {result.summary}")
# Access insights
for insight in result.insights:
print(f"💡 {insight}")
# Access metrics
print(f"📊 Metrics: {result.metrics}")
# Access processed data
processed_data = result.data
else:
print(f"❌ Processing failed: {result.error_message}")
# Get processing statistics
stats = processor.get_statistics()
print(f"Total processed: {stats['total_processed']}")
print(f"Success rate: {stats['success_rate']:.2%}")
print(f"Average processing time: {stats['average_processing_time']:.3f}s")
# Reset statistics
processor.reset_statistics()
from matrice_analytics.post_processing.core.base import BaseProcessor
class MyCustomUseCase(BaseProcessor):
def __init__(self):
super().__init__("my_custom_usecase")
self.category = "custom"
def process(self, data, config, context=None):
# Implement your processing logic
return self.create_result(processed_data, "my_custom_usecase", "custom")
from matrice_analytics.post_processing.core.base import registry
registry.register_use_case("custom", "my_custom_usecase", MyCustomUseCase)
Add utility functions to the appropriate module in the utils/ directory and export them in utils/__init__.py.
The system includes comprehensive error handling and validation. Here's how to test your implementations:
# Test configuration validation
errors = processor.validate_config({
'usecase': 'people_counting',
'confidence_threshold': 0.5
})
# Test with sample data
sample_data = [
{'category': 'person', 'confidence': 0.8, 'bbox': [10, 10, 50, 50]}
]
result = process_simple(sample_data, 'people_counting')
assert result.is_success()
If you're migrating from the old post-processing system:
Update Imports:
# Old
from matrice_analytics.old_post_processing import some_function
# New
from matrice_analytics.post_processing import PostProcessor, process_simple
Update Processing Calls:
# Old
result = old_process_function(data, config_dict)
# New
result = process_simple(data, "usecase_name", **config_dict)
Update Configuration:
# Old
config = {"threshold": 0.5, "enable_tracking": True}
# New
config = processor.create_config("people_counting",
confidence_threshold=0.5,
enable_tracking=True)
Use Case Not Found:
# Check available use cases
print(processor.list_available_usecases())
Configuration Validation Errors:
# Validate configuration
errors = processor.validate_config(config)
if errors:
print(f"Validation errors: {errors}")
Processing Failures:
# Check result status and error details
if not result.is_success():
print(f"Error: {result.error_message}")
print(f"Error type: {result.error_type}")
print(f"Error details: {result.error_details}")
PostProcessor: Main processing classProcessingResult: Standardized result containerBaseConfig: Base configuration classPeopleCountingConfig: People counting configurationCustomerServiceConfig: Customer service configurationprocess_simple(): Simple processing functioncreate_config_template(): Get configuration templatelist_available_usecases(): List available use casesvalidate_config(): Validate configurationThe system provides comprehensive utility functions organized by category:
Use Simple Processing for Quick Tasks:
result = process_simple(data, "people_counting", confidence_threshold=0.5)
Use PostProcessor Class for Complex Workflows:
processor = PostProcessor()
config = processor.create_config("people_counting", **params)
result = processor.process(data, config)
Always Check Result Status:
if result.is_success():
# Process successful result
else:
# Handle error
Use Configuration Files for Complex Setups:
processor.save_config(config, "config.json")
result = processor.process_from_file(data, "config.json")
Monitor Processing Statistics:
stats = processor.get_statistics()
# Monitor success rates and performance
The refactored system is designed for easy extension. Planned enhancements include:
The refactored post-processing system provides a solid foundation for scalable, maintainable, and powerful analytics capabilities. The clean architecture makes it easy to extend and customize for specific use cases while maintaining consistency and reliability.
FAQs
Common server utilities for Matrice.ai services
We found that matrice-analytics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.