matrice-analytics 0.1.60__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- matrice_analytics/__init__.py +28 -0
- matrice_analytics/boundary_drawing_internal/README.md +305 -0
- matrice_analytics/boundary_drawing_internal/__init__.py +45 -0
- matrice_analytics/boundary_drawing_internal/boundary_drawing_internal.py +1207 -0
- matrice_analytics/boundary_drawing_internal/boundary_drawing_tool.py +429 -0
- matrice_analytics/boundary_drawing_internal/boundary_tool_template.html +1036 -0
- matrice_analytics/boundary_drawing_internal/data/.gitignore +12 -0
- matrice_analytics/boundary_drawing_internal/example_usage.py +206 -0
- matrice_analytics/boundary_drawing_internal/usage/README.md +110 -0
- matrice_analytics/boundary_drawing_internal/usage/boundary_drawer_launcher.py +102 -0
- matrice_analytics/boundary_drawing_internal/usage/simple_boundary_launcher.py +107 -0
- matrice_analytics/post_processing/README.md +455 -0
- matrice_analytics/post_processing/__init__.py +732 -0
- matrice_analytics/post_processing/advanced_tracker/README.md +650 -0
- matrice_analytics/post_processing/advanced_tracker/__init__.py +17 -0
- matrice_analytics/post_processing/advanced_tracker/base.py +99 -0
- matrice_analytics/post_processing/advanced_tracker/config.py +77 -0
- matrice_analytics/post_processing/advanced_tracker/kalman_filter.py +370 -0
- matrice_analytics/post_processing/advanced_tracker/matching.py +195 -0
- matrice_analytics/post_processing/advanced_tracker/strack.py +230 -0
- matrice_analytics/post_processing/advanced_tracker/tracker.py +367 -0
- matrice_analytics/post_processing/config.py +146 -0
- matrice_analytics/post_processing/core/__init__.py +63 -0
- matrice_analytics/post_processing/core/base.py +704 -0
- matrice_analytics/post_processing/core/config.py +3291 -0
- matrice_analytics/post_processing/core/config_utils.py +925 -0
- matrice_analytics/post_processing/face_reg/__init__.py +43 -0
- matrice_analytics/post_processing/face_reg/compare_similarity.py +556 -0
- matrice_analytics/post_processing/face_reg/embedding_manager.py +950 -0
- matrice_analytics/post_processing/face_reg/face_recognition.py +2234 -0
- matrice_analytics/post_processing/face_reg/face_recognition_client.py +606 -0
- matrice_analytics/post_processing/face_reg/people_activity_logging.py +321 -0
- matrice_analytics/post_processing/ocr/__init__.py +0 -0
- matrice_analytics/post_processing/ocr/easyocr_extractor.py +250 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/__init__.py +9 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/__init__.py +4 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/cli.py +33 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/dataset_stats.py +139 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/export.py +398 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/train.py +447 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/utils.py +129 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/valid.py +93 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/validate_dataset.py +240 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/visualize_augmentation.py +176 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/cli/visualize_predictions.py +96 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/__init__.py +3 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/process.py +246 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/types.py +60 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/core/utils.py +87 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/__init__.py +3 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/config.py +82 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/hub.py +141 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/inference/plate_recognizer.py +323 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/py.typed +0 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/__init__.py +0 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/__init__.py +0 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/augmentation.py +101 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/data/dataset.py +97 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/__init__.py +0 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/config.py +114 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/layers.py +553 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/loss.py +55 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/metric.py +86 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/model_builders.py +95 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/model/model_schema.py +395 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/__init__.py +0 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/backend_utils.py +38 -0
- matrice_analytics/post_processing/ocr/fast_plate_ocr_py38/train/utilities/utils.py +214 -0
- matrice_analytics/post_processing/ocr/postprocessing.py +270 -0
- matrice_analytics/post_processing/ocr/preprocessing.py +52 -0
- matrice_analytics/post_processing/post_processor.py +1175 -0
- matrice_analytics/post_processing/test_cases/__init__.py +1 -0
- matrice_analytics/post_processing/test_cases/run_tests.py +143 -0
- matrice_analytics/post_processing/test_cases/test_advanced_customer_service.py +841 -0
- matrice_analytics/post_processing/test_cases/test_basic_counting_tracking.py +523 -0
- matrice_analytics/post_processing/test_cases/test_comprehensive.py +531 -0
- matrice_analytics/post_processing/test_cases/test_config.py +852 -0
- matrice_analytics/post_processing/test_cases/test_customer_service.py +585 -0
- matrice_analytics/post_processing/test_cases/test_data_generators.py +583 -0
- matrice_analytics/post_processing/test_cases/test_people_counting.py +510 -0
- matrice_analytics/post_processing/test_cases/test_processor.py +524 -0
- matrice_analytics/post_processing/test_cases/test_usecases.py +165 -0
- matrice_analytics/post_processing/test_cases/test_utilities.py +356 -0
- matrice_analytics/post_processing/test_cases/test_utils.py +743 -0
- matrice_analytics/post_processing/usecases/Histopathological_Cancer_Detection_img.py +604 -0
- matrice_analytics/post_processing/usecases/__init__.py +267 -0
- matrice_analytics/post_processing/usecases/abandoned_object_detection.py +797 -0
- matrice_analytics/post_processing/usecases/advanced_customer_service.py +1601 -0
- matrice_analytics/post_processing/usecases/age_detection.py +842 -0
- matrice_analytics/post_processing/usecases/age_gender_detection.py +1085 -0
- matrice_analytics/post_processing/usecases/anti_spoofing_detection.py +656 -0
- matrice_analytics/post_processing/usecases/assembly_line_detection.py +841 -0
- matrice_analytics/post_processing/usecases/banana_defect_detection.py +624 -0
- matrice_analytics/post_processing/usecases/basic_counting_tracking.py +667 -0
- matrice_analytics/post_processing/usecases/blood_cancer_detection_img.py +881 -0
- matrice_analytics/post_processing/usecases/car_damage_detection.py +834 -0
- matrice_analytics/post_processing/usecases/car_part_segmentation.py +946 -0
- matrice_analytics/post_processing/usecases/car_service.py +1601 -0
- matrice_analytics/post_processing/usecases/cardiomegaly_classification.py +864 -0
- matrice_analytics/post_processing/usecases/cell_microscopy_segmentation.py +897 -0
- matrice_analytics/post_processing/usecases/chicken_pose_detection.py +648 -0
- matrice_analytics/post_processing/usecases/child_monitoring.py +814 -0
- matrice_analytics/post_processing/usecases/color/clip.py +660 -0
- matrice_analytics/post_processing/usecases/color/clip_processor/merges.txt +48895 -0
- matrice_analytics/post_processing/usecases/color/clip_processor/preprocessor_config.json +28 -0
- matrice_analytics/post_processing/usecases/color/clip_processor/special_tokens_map.json +30 -0
- matrice_analytics/post_processing/usecases/color/clip_processor/tokenizer.json +245079 -0
- matrice_analytics/post_processing/usecases/color/clip_processor/tokenizer_config.json +32 -0
- matrice_analytics/post_processing/usecases/color/clip_processor/vocab.json +1 -0
- matrice_analytics/post_processing/usecases/color/color_map_utils.py +70 -0
- matrice_analytics/post_processing/usecases/color/color_mapper.py +468 -0
- matrice_analytics/post_processing/usecases/color_detection.py +1936 -0
- matrice_analytics/post_processing/usecases/color_map_utils.py +70 -0
- matrice_analytics/post_processing/usecases/concrete_crack_detection.py +827 -0
- matrice_analytics/post_processing/usecases/crop_weed_detection.py +781 -0
- matrice_analytics/post_processing/usecases/customer_service.py +1008 -0
- matrice_analytics/post_processing/usecases/defect_detection_products.py +936 -0
- matrice_analytics/post_processing/usecases/distracted_driver_detection.py +822 -0
- matrice_analytics/post_processing/usecases/drone_traffic_monitoring.py +585 -0
- matrice_analytics/post_processing/usecases/drowsy_driver_detection.py +829 -0
- matrice_analytics/post_processing/usecases/dwell_detection.py +829 -0
- matrice_analytics/post_processing/usecases/emergency_vehicle_detection.py +827 -0
- matrice_analytics/post_processing/usecases/face_emotion.py +813 -0
- matrice_analytics/post_processing/usecases/face_recognition.py +827 -0
- matrice_analytics/post_processing/usecases/fashion_detection.py +835 -0
- matrice_analytics/post_processing/usecases/field_mapping.py +902 -0
- matrice_analytics/post_processing/usecases/fire_detection.py +1146 -0
- matrice_analytics/post_processing/usecases/flare_analysis.py +836 -0
- matrice_analytics/post_processing/usecases/flower_segmentation.py +1006 -0
- matrice_analytics/post_processing/usecases/gas_leak_detection.py +837 -0
- matrice_analytics/post_processing/usecases/gender_detection.py +832 -0
- matrice_analytics/post_processing/usecases/human_activity_recognition.py +871 -0
- matrice_analytics/post_processing/usecases/intrusion_detection.py +1672 -0
- matrice_analytics/post_processing/usecases/leaf.py +821 -0
- matrice_analytics/post_processing/usecases/leaf_disease.py +840 -0
- matrice_analytics/post_processing/usecases/leak_detection.py +837 -0
- matrice_analytics/post_processing/usecases/license_plate_detection.py +1188 -0
- matrice_analytics/post_processing/usecases/license_plate_monitoring.py +1781 -0
- matrice_analytics/post_processing/usecases/litter_monitoring.py +717 -0
- matrice_analytics/post_processing/usecases/mask_detection.py +869 -0
- matrice_analytics/post_processing/usecases/natural_disaster.py +907 -0
- matrice_analytics/post_processing/usecases/parking.py +787 -0
- matrice_analytics/post_processing/usecases/parking_space_detection.py +822 -0
- matrice_analytics/post_processing/usecases/pcb_defect_detection.py +888 -0
- matrice_analytics/post_processing/usecases/pedestrian_detection.py +808 -0
- matrice_analytics/post_processing/usecases/people_counting.py +706 -0
- matrice_analytics/post_processing/usecases/people_counting_bckp.py +1683 -0
- matrice_analytics/post_processing/usecases/people_tracking.py +1842 -0
- matrice_analytics/post_processing/usecases/pipeline_detection.py +605 -0
- matrice_analytics/post_processing/usecases/plaque_segmentation_img.py +874 -0
- matrice_analytics/post_processing/usecases/pothole_segmentation.py +915 -0
- matrice_analytics/post_processing/usecases/ppe_compliance.py +645 -0
- matrice_analytics/post_processing/usecases/price_tag_detection.py +822 -0
- matrice_analytics/post_processing/usecases/proximity_detection.py +1901 -0
- matrice_analytics/post_processing/usecases/road_lane_detection.py +623 -0
- matrice_analytics/post_processing/usecases/road_traffic_density.py +832 -0
- matrice_analytics/post_processing/usecases/road_view_segmentation.py +915 -0
- matrice_analytics/post_processing/usecases/shelf_inventory_detection.py +583 -0
- matrice_analytics/post_processing/usecases/shoplifting_detection.py +822 -0
- matrice_analytics/post_processing/usecases/shopping_cart_analysis.py +899 -0
- matrice_analytics/post_processing/usecases/skin_cancer_classification_img.py +864 -0
- matrice_analytics/post_processing/usecases/smoker_detection.py +833 -0
- matrice_analytics/post_processing/usecases/solar_panel.py +810 -0
- matrice_analytics/post_processing/usecases/suspicious_activity_detection.py +1030 -0
- matrice_analytics/post_processing/usecases/template_usecase.py +380 -0
- matrice_analytics/post_processing/usecases/theft_detection.py +648 -0
- matrice_analytics/post_processing/usecases/traffic_sign_monitoring.py +724 -0
- matrice_analytics/post_processing/usecases/underground_pipeline_defect_detection.py +775 -0
- matrice_analytics/post_processing/usecases/underwater_pollution_detection.py +842 -0
- matrice_analytics/post_processing/usecases/vehicle_monitoring.py +1029 -0
- matrice_analytics/post_processing/usecases/warehouse_object_segmentation.py +899 -0
- matrice_analytics/post_processing/usecases/waterbody_segmentation.py +923 -0
- matrice_analytics/post_processing/usecases/weapon_detection.py +771 -0
- matrice_analytics/post_processing/usecases/weld_defect_detection.py +615 -0
- matrice_analytics/post_processing/usecases/wildlife_monitoring.py +898 -0
- matrice_analytics/post_processing/usecases/windmill_maintenance.py +834 -0
- matrice_analytics/post_processing/usecases/wound_segmentation.py +856 -0
- matrice_analytics/post_processing/utils/__init__.py +150 -0
- matrice_analytics/post_processing/utils/advanced_counting_utils.py +400 -0
- matrice_analytics/post_processing/utils/advanced_helper_utils.py +317 -0
- matrice_analytics/post_processing/utils/advanced_tracking_utils.py +461 -0
- matrice_analytics/post_processing/utils/alerting_utils.py +213 -0
- matrice_analytics/post_processing/utils/category_mapping_utils.py +94 -0
- matrice_analytics/post_processing/utils/color_utils.py +592 -0
- matrice_analytics/post_processing/utils/counting_utils.py +182 -0
- matrice_analytics/post_processing/utils/filter_utils.py +261 -0
- matrice_analytics/post_processing/utils/format_utils.py +293 -0
- matrice_analytics/post_processing/utils/geometry_utils.py +300 -0
- matrice_analytics/post_processing/utils/smoothing_utils.py +358 -0
- matrice_analytics/post_processing/utils/tracking_utils.py +234 -0
- matrice_analytics/py.typed +0 -0
- matrice_analytics-0.1.60.dist-info/METADATA +481 -0
- matrice_analytics-0.1.60.dist-info/RECORD +196 -0
- matrice_analytics-0.1.60.dist-info/WHEEL +5 -0
- matrice_analytics-0.1.60.dist-info/licenses/LICENSE.txt +21 -0
- matrice_analytics-0.1.60.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Utilities package for Matrice Deploy.
|
|
3
|
+
|
|
4
|
+
This package contains utility modules for the Matrice deployment system.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# Import post_processing module components for easy access
|
|
8
|
+
from . import post_processing
|
|
9
|
+
|
|
10
|
+
# Re-export commonly used items from post_processing for convenience
|
|
11
|
+
from .post_processing import (
|
|
12
|
+
PostProcessor,
|
|
13
|
+
create_config_from_template,
|
|
14
|
+
create_people_counting_config,
|
|
15
|
+
process_simple,
|
|
16
|
+
list_available_usecases,
|
|
17
|
+
validate_config
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
'post_processing',
|
|
22
|
+
'PostProcessor',
|
|
23
|
+
'create_config_from_template',
|
|
24
|
+
'create_people_counting_config',
|
|
25
|
+
'process_simple',
|
|
26
|
+
'list_available_usecases',
|
|
27
|
+
'validate_config'
|
|
28
|
+
]
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# 🎯 Boundary Drawing Tool
|
|
2
|
+
|
|
3
|
+
A comprehensive tool for creating interactive boundary definitions from video frames or images. Perfect for defining zones like queues, staff areas, entry/exit points, security zones, and more for computer vision applications.
|
|
4
|
+
|
|
5
|
+
## 📋 Features
|
|
6
|
+
|
|
7
|
+
- **Multi-format Support**: Works with videos (MP4, AVI, MOV, etc.) and images (JPG, PNG, etc.)
|
|
8
|
+
- **Interactive HTML Interface**: User-friendly drag-and-drop interface with real-time visualization
|
|
9
|
+
- **Multiple Zone Types**: Pre-defined zone types with custom tag support
|
|
10
|
+
- **Drawing Modes**: Support for both polygons and lines
|
|
11
|
+
- **Grid Reference**: Optional grid overlay for precise coordinate placement
|
|
12
|
+
- **Code Generation**: Automatic Python code generation ready for use in applications
|
|
13
|
+
- **Save/Load Configurations**: Export and import zone configurations as JSON
|
|
14
|
+
- **Real-time Preview**: Live preview of drawn zones with color coding
|
|
15
|
+
- **Browser-based**: No additional software required - works in any modern web browser
|
|
16
|
+
|
|
17
|
+
## 🚀 Quick Start
|
|
18
|
+
|
|
19
|
+
### Easy Import and Use (Recommended)
|
|
20
|
+
|
|
21
|
+
The simplest way to use the boundary drawing tool:
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
# One-line usage for any video or image
|
|
25
|
+
from matrice_analytics.boundary_drawing_internal import quick_boundary_tool
|
|
26
|
+
|
|
27
|
+
# Creates tool and opens in browser automatically
|
|
28
|
+
quick_boundary_tool("my_video.mp4", zones_needed=["queue", "staff", "exit"])
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or use the class for more control:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from matrice_analytics.boundary_drawing_internal import EasyBoundaryTool
|
|
35
|
+
|
|
36
|
+
# Initialize with custom settings
|
|
37
|
+
tool = EasyBoundaryTool(auto_open_browser=True, grid_step=50)
|
|
38
|
+
|
|
39
|
+
# Create from video (auto-extracts first frame)
|
|
40
|
+
html_path = tool.create_from_video("security_camera.mp4")
|
|
41
|
+
|
|
42
|
+
# Or create from image
|
|
43
|
+
html_path = tool.create_from_image("frame.jpg")
|
|
44
|
+
|
|
45
|
+
# Auto-detect file type
|
|
46
|
+
html_path = tool.quick_setup("any_file.mp4", zones_needed=["queue", "staff"])
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Create a standalone drag & drop tool:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from matrice_analytics.boundary_drawing_internal import create_standalone_tool
|
|
53
|
+
|
|
54
|
+
# Creates a tool that accepts any uploaded file
|
|
55
|
+
create_standalone_tool("my_boundary_tool.html")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Command Line Usage
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Process a video file
|
|
62
|
+
python boundary_drawing_internal.py --input video.mp4
|
|
63
|
+
|
|
64
|
+
# Process an image with custom grid spacing
|
|
65
|
+
python boundary_drawing_internal.py --input frame.jpg --grid-step 25
|
|
66
|
+
|
|
67
|
+
# Create tool without opening browser automatically
|
|
68
|
+
python boundary_drawing_internal.py --input video.mp4 --no-browser
|
|
69
|
+
|
|
70
|
+
# Specify output directory
|
|
71
|
+
python boundary_drawing_internal.py --input video.mp4 --output ./boundaries/
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Programmatic Usage
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from matrice_analytics.boundary_drawing_internal import BoundaryDrawingTool
|
|
78
|
+
|
|
79
|
+
# Initialize the tool
|
|
80
|
+
tool = BoundaryDrawingTool()
|
|
81
|
+
|
|
82
|
+
# Process a video file
|
|
83
|
+
results = tool.process_input_file(
|
|
84
|
+
input_path="video.mp4",
|
|
85
|
+
output_dir="./boundaries/",
|
|
86
|
+
grid_step=50,
|
|
87
|
+
open_browser=True,
|
|
88
|
+
embed_image=True
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
# Or just extract first frame
|
|
92
|
+
frame_path = tool.extract_first_frame("video.mp4", "first_frame.jpg")
|
|
93
|
+
|
|
94
|
+
# Create grid reference
|
|
95
|
+
grid_path = tool.create_grid_reference_image("first_frame.jpg", "grid.jpg")
|
|
96
|
+
|
|
97
|
+
# Create interactive HTML tool
|
|
98
|
+
html_path = tool.create_interactive_html("grid.jpg", "tool.html")
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 🎨 Zone Types
|
|
102
|
+
|
|
103
|
+
The tool comes with pre-defined zone types, each with distinct colors:
|
|
104
|
+
|
|
105
|
+
- 🏃 **Queue Area** (Green) - Customer queue zones
|
|
106
|
+
- 👥 **Staff Area** (Teal) - Staff working areas
|
|
107
|
+
- 🚪 **Entry Zone** (Yellow) - Entry points
|
|
108
|
+
- 🚶 **Exit Zone** (Red) - Exit points
|
|
109
|
+
- 🚫 **Restricted** (Purple) - Restricted access areas
|
|
110
|
+
- ⏰ **Waiting Area** (Orange) - General waiting areas
|
|
111
|
+
- 🛎️ **Service Area** (Mint) - Customer service zones
|
|
112
|
+
- 🔒 **Security Zone** (Dark Gray) - Security checkpoints
|
|
113
|
+
|
|
114
|
+
You can also create **custom zone types** by typing in the custom tag input field.
|
|
115
|
+
|
|
116
|
+
## 🖱️ How to Use the Interactive Tool
|
|
117
|
+
|
|
118
|
+
### 1. Load Your File
|
|
119
|
+
- **Drag & Drop**: Drag a video or image file onto the upload area
|
|
120
|
+
- **Click to Browse**: Click the upload area to select a file
|
|
121
|
+
- **Supported Formats**: JPG, PNG, MP4, AVI, MOV, MKV, WMV, FLV, WEBM
|
|
122
|
+
|
|
123
|
+
### 2. Select Zone Type
|
|
124
|
+
- Click on one of the pre-defined zone type buttons
|
|
125
|
+
- Or enter a custom zone name in the text field and click "Add"
|
|
126
|
+
|
|
127
|
+
### 3. Choose Drawing Mode
|
|
128
|
+
- **📐 Polygon**: For area definitions (requires minimum 3 points)
|
|
129
|
+
- **📏 Line**: For boundary lines (requires exactly 2 points)
|
|
130
|
+
|
|
131
|
+
### 4. Draw Your Zones
|
|
132
|
+
- **Click** on the image to add points
|
|
133
|
+
- **Right-click** or press **Enter** to complete the current zone
|
|
134
|
+
- **Press Escape** to cancel the current zone
|
|
135
|
+
- **Ctrl+Z** to undo the last point
|
|
136
|
+
|
|
137
|
+
### 5. Export Your Work
|
|
138
|
+
- **📋 Generate Code**: Creates Python code ready for use
|
|
139
|
+
- **💾 Save Config**: Download configuration as JSON file
|
|
140
|
+
- **📁 Load Config**: Load previously saved configurations
|
|
141
|
+
|
|
142
|
+
## 📝 Generated Code Format
|
|
143
|
+
|
|
144
|
+
The tool generates Python code in the following format:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
# Generated boundary definitions
|
|
148
|
+
zones = {
|
|
149
|
+
"queue": [[100, 200], [300, 200], [300, 400], [100, 400]],
|
|
150
|
+
"staff": [[500, 100], [700, 100], [700, 300], [500, 300]],
|
|
151
|
+
"entry": [[50, 50], [150, 100]]
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
# Usage examples:
|
|
155
|
+
# For post-processing configuration:
|
|
156
|
+
# config.customer_service.customer_areas = zones["queue"]
|
|
157
|
+
# config.advanced_tracking.boundary_config = { "points": zones["entry"] }
|
|
158
|
+
|
|
159
|
+
# Individual zone coordinates:
|
|
160
|
+
# queue polygon (4 points):
|
|
161
|
+
queue_1 = [[100, 200], [300, 200], [300, 400], [100, 400]]
|
|
162
|
+
# staff polygon (4 points):
|
|
163
|
+
staff_1 = [[500, 100], [700, 100], [700, 300], [500, 300]]
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## 🔧 Integration with Matrice SDK
|
|
167
|
+
|
|
168
|
+
### Customer Service Processor
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from matrice_analytics.post_processing import CustomerServiceProcessor
|
|
172
|
+
|
|
173
|
+
# Use your defined zones
|
|
174
|
+
processor = CustomerServiceProcessor(
|
|
175
|
+
customer_areas=zones["queue"],
|
|
176
|
+
staff_areas=zones["staff"],
|
|
177
|
+
service_areas=zones["service"]
|
|
178
|
+
)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Advanced Tracking Processor
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
from matrice_analytics.post_processing import AdvancedTrackingProcessor
|
|
185
|
+
from matrice_analytics.post_processing.config import AdvancedTrackingConfig
|
|
186
|
+
|
|
187
|
+
config = AdvancedTrackingConfig(
|
|
188
|
+
boundary_config={
|
|
189
|
+
"points": zones["entry"],
|
|
190
|
+
"type": "line"
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
processor = AdvancedTrackingProcessor(config)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Counting Processor
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
from matrice_analytics.post_processing import CountingProcessor
|
|
201
|
+
|
|
202
|
+
# Count objects in specific zones
|
|
203
|
+
results = processor.count_in_zones(
|
|
204
|
+
results=detection_results,
|
|
205
|
+
zones=zones
|
|
206
|
+
)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## 📁 Output Files
|
|
210
|
+
|
|
211
|
+
When you run the tool, it creates several files:
|
|
212
|
+
|
|
213
|
+
- **`*_first_frame.jpg`**: Extracted first frame (for videos)
|
|
214
|
+
- **`*_grid_reference.jpg`**: Frame with grid overlay for coordinate reference
|
|
215
|
+
- **`*_boundary_tool.html`**: Interactive HTML tool for drawing zones
|
|
216
|
+
- **`boundary_config.json`**: Saved zone configurations (when exported)
|
|
217
|
+
|
|
218
|
+
## ⚙️ Command Line Options
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
python boundary_drawing_internal.py [OPTIONS]
|
|
222
|
+
|
|
223
|
+
Options:
|
|
224
|
+
--input, -i TEXT Input video or image file [required]
|
|
225
|
+
--output, -o TEXT Output directory for generated files
|
|
226
|
+
--grid-step INTEGER Grid line spacing in pixels (default: 50)
|
|
227
|
+
--no-browser Do not open the tool in browser automatically
|
|
228
|
+
--no-embed Do not embed image as base64 in HTML
|
|
229
|
+
--help Show this message and exit
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## 🌐 Browser Compatibility
|
|
233
|
+
|
|
234
|
+
The tool works in all modern web browsers:
|
|
235
|
+
- Chrome 70+
|
|
236
|
+
- Firefox 65+
|
|
237
|
+
- Safari 12+
|
|
238
|
+
- Edge 79+
|
|
239
|
+
|
|
240
|
+
## 📚 Use Cases
|
|
241
|
+
|
|
242
|
+
### Airport Security
|
|
243
|
+
- Define security zones with different threat levels
|
|
244
|
+
- Create passenger flow boundaries
|
|
245
|
+
- Mark restricted access areas
|
|
246
|
+
|
|
247
|
+
### Retail Analytics
|
|
248
|
+
- Queue management for checkout counters
|
|
249
|
+
- Customer flow analysis
|
|
250
|
+
- Staff monitoring zones
|
|
251
|
+
|
|
252
|
+
### Healthcare Facilities
|
|
253
|
+
- Patient waiting areas
|
|
254
|
+
- Staff-only zones
|
|
255
|
+
- Emergency access routes
|
|
256
|
+
|
|
257
|
+
### Manufacturing
|
|
258
|
+
- Worker safety zones
|
|
259
|
+
- Quality control areas
|
|
260
|
+
- Equipment boundaries
|
|
261
|
+
|
|
262
|
+
## 🔍 Tips & Best Practices
|
|
263
|
+
|
|
264
|
+
1. **Use Grid Reference**: Enable grid overlay for precise coordinate placement
|
|
265
|
+
2. **Start with Large Areas**: Define major zones first, then refine with smaller areas
|
|
266
|
+
3. **Save Frequently**: Export configurations regularly to avoid losing work
|
|
267
|
+
4. **Test Different Grid Sizes**: Smaller grid steps (25-30px) for detailed work, larger (75-100px) for quick layouts
|
|
268
|
+
5. **Color Coding**: Use the color-coded zones to quickly identify different area types
|
|
269
|
+
6. **Custom Tags**: Create meaningful custom zone names for specific use cases
|
|
270
|
+
|
|
271
|
+
## 🐛 Troubleshooting
|
|
272
|
+
|
|
273
|
+
### Video Won't Load
|
|
274
|
+
- Ensure the video format is supported (MP4, AVI, MOV, etc.)
|
|
275
|
+
- Try converting to MP4 if using an uncommon format
|
|
276
|
+
- Check that the video file isn't corrupted
|
|
277
|
+
|
|
278
|
+
### HTML Tool Not Opening
|
|
279
|
+
- Check if popup blockers are enabled in your browser
|
|
280
|
+
- Manually open the generated HTML file
|
|
281
|
+
- Ensure JavaScript is enabled in your browser
|
|
282
|
+
|
|
283
|
+
### Coordinates Look Wrong
|
|
284
|
+
- Verify the grid scale matches your requirements
|
|
285
|
+
- Check that you're clicking on the correct positions
|
|
286
|
+
- Use the mouse tracker in the bottom-right corner for real-time coordinates
|
|
287
|
+
|
|
288
|
+
## 📄 License
|
|
289
|
+
|
|
290
|
+
This tool is part of the Matrice AI SDK and follows the same licensing terms.
|
|
291
|
+
|
|
292
|
+
## 🤝 Contributing
|
|
293
|
+
|
|
294
|
+
To contribute to this tool:
|
|
295
|
+
1. Follow the existing code style
|
|
296
|
+
2. Add tests for new features
|
|
297
|
+
3. Update documentation for any changes
|
|
298
|
+
4. Submit a pull request with a clear description
|
|
299
|
+
|
|
300
|
+
## 📞 Support
|
|
301
|
+
|
|
302
|
+
For support with the boundary drawing tool:
|
|
303
|
+
- Check the troubleshooting section above
|
|
304
|
+
- Review the examples in the Matrice SDK documentation
|
|
305
|
+
- Contact the development team for technical issues
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Boundary Drawing Tool - Interactive zone definition for computer vision applications.
|
|
3
|
+
|
|
4
|
+
This module provides tools for creating interactive boundary definitions from video frames
|
|
5
|
+
or images. Perfect for defining zones like queues, staff areas, entry/exit points,
|
|
6
|
+
security zones, and more for computer vision applications.
|
|
7
|
+
|
|
8
|
+
Easy Usage Examples:
|
|
9
|
+
# Quick one-liner to create a tool from any file
|
|
10
|
+
from matrice_analytics.boundary_drawing_internal import quick_boundary_tool
|
|
11
|
+
quick_boundary_tool("my_video.mp4", zones_needed=["queue", "staff", "exit"])
|
|
12
|
+
|
|
13
|
+
# Or use the class for more control
|
|
14
|
+
from matrice_analytics.boundary_drawing_internal import EasyBoundaryTool
|
|
15
|
+
tool = EasyBoundaryTool()
|
|
16
|
+
html_path = tool.create_from_video("security_camera.mp4")
|
|
17
|
+
|
|
18
|
+
# Create a standalone tool for drag & drop
|
|
19
|
+
from matrice_analytics.boundary_drawing_internal import create_standalone_tool
|
|
20
|
+
create_standalone_tool("my_boundary_tool.html")
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
# Import both the detailed and easy-to-use tools
|
|
24
|
+
from .boundary_drawing_internal import BoundaryDrawingTool
|
|
25
|
+
from .boundary_drawing_tool import (
|
|
26
|
+
EasyBoundaryTool,
|
|
27
|
+
quick_boundary_tool,
|
|
28
|
+
create_standalone_tool,
|
|
29
|
+
get_usage_template
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
# Main detailed tool
|
|
34
|
+
'BoundaryDrawingTool',
|
|
35
|
+
|
|
36
|
+
# Easy-to-use tools (recommended for most users)
|
|
37
|
+
'EasyBoundaryTool',
|
|
38
|
+
'quick_boundary_tool',
|
|
39
|
+
'create_standalone_tool',
|
|
40
|
+
'get_usage_template'
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
__version__ = '1.0.0'
|
|
44
|
+
__author__ = 'Matrice AI'
|
|
45
|
+
__description__ = 'Interactive boundary drawing tool for computer vision applications'
|