-
Notifications
You must be signed in to change notification settings - Fork 1
Home EN
Welcome to the documentation for the CVCounter project!
CVCounter is a mini-website designed to track the number of objects in a video through a web interface. It serves as a simple and convenient tool for monitoring object flows (e.g., entry and exit or conveyor systems).
This solution does not require additional client-side software and works on any device with a browser. It offers three viewing modes: the main view with video, a text-only view, and a text view with dual counters. The project is intended to be lightweight and resource-efficient, especially when the video mode is not used.
- Web interface for displaying object counts
- Video view with recognition results
- Text-only modes for simplicity and resource-saving
- Dual counter display for monitoring entry and exit simultaneously
- Viewing reports on calculations
- Viewing system information
-
Clone the repository:
git clone https://github.com/BespredeL/CVCounter.git
-
Navigate to the project directory:
cd CVCounter -
Install virtual environment:
python3 -m venv venv
-
Activate virtual environment:
- On Windows:
.\venv\Scripts\activate
- On Linux/Mac:
source venv/bin/activate
- On Windows:
-
Install dependencies:
pip3 install -r requirements.txt
-
Rename the configuration file:
mv config.example.json config.json
- Change the parameters in the configuration file, add your YOLO model.
-
Run the application:
python app.py
-
Clone the repository:
git clone https://github.com/BespredeL/CVCounter.git
-
Navigate to the project directory:
cd CVCounter -
Build and run using Docker Compose:
docker-compose up --build
All primary configurations are stored in the config.json file.
| Parameter | Description | Default Value |
|---|---|---|
debug |
Enable debug mode | true |
log_path |
Path to the log file | errors.log |
log_level |
Minimum log level | INFO |
log_console |
Enable logging to console | false |
default_language |
Default language | ru |
allow_unsafe_werkzeug |
Allow unsafe operations in Werkzeug | false |
button_change_theme |
Show theme change button | true |
button_fullscreen |
Show fullscreen button | true |
button_backward |
Show back button | false |
button_save_capture |
Show save capture button | false |
collapsed_keyboard |
Show collapsed keyboard | true |
| Parameter | Description | Default Value |
|---|---|---|
host |
Server address | 0.0.0.0 |
port |
Server port | 8080 |
threaded |
Enable multithreading | true |
use_reloader |
Enable reload mode | false |
log_output |
Enable log output | true |
socketio_key |
SocketIO key | "" |
allowed_origins |
Allowed address for Access-Control-Allow-Origin | * |
| Parameter | Description | Default Value |
|---|---|---|
admin |
Login and password | admin:admin |
| Parameter | Description | Default Value |
|---|---|---|
uri |
Database connection URI | sqlite:///system/database.db |
prefix |
Table prefix | "" |
| Parameter | Description | Default Value |
|---|---|---|
defect_show |
Show defect form | true |
correct_show |
Show correction form | true |
custom_fields |
Configuration for custom fields | [{"name": "field_one", "label": "Field One", "type": "text"}] |
| Parameter | Description | Default Value |
|---|---|---|
model_type |
Model type | yolo |
weights_path |
Model path | yolo_cfg/models/yolov8n.pt |
video_show_scale |
Video display scale on the page | 50 |
video_show_quality |
Video display quality on the page | 50 |
video_fps |
Manual FPS setting (0 - automatic) | 0 |
confidence |
Confidence threshold | 0.7 |
iou |
IOU threshold | 0.7 |
device |
Compute device | 0 |
vid_stride |
Video stream step | 1 |
indicator_size |
Indicator size | 10 |
counting_area |
Counting area (polygon) | [[0, 0], [100, 0], [100, 100], [0, 100]] |
counting_area_color |
Counting area color | [67, 211, 255] |
classes |
Detection classes | {} |
| Parameter | Description | Default Value |
|---|---|---|
enable |
Enable recording | false |
path |
Video saving path | yolo_cfg/saved_recordings |
scale |
Video size (in percent) | 100 |
quality |
Video quality | 80 |
| Parameter | Description | Default Value |
|---|---|---|
label |
Counter label | Label ExampleCam |
start_total_count |
Initial counter value | 0 |
video_path |
Path to video file or camera source | "" |
video_show_scale |
Video display scale on the page | 70 |
video_show_quality |
Video display quality on the page | 30 |
video_fps |
Manual FPS setting (0 - automatic) | 0 |
model_type |
Model type | yolo |
weights_path |
Model path | yolo_cfg/models/yolov8n.pt |
confidence |
Confidence threshold | 0.7 |
iou |
IOU threshold | 0.7 |
device |
Compute device | 0 |
vid_stride |
Video stream step | 1 |
indicator_size |
Indicator size | 10 |
counting_area |
Counting area (polygon) | [[0, 0], [100, 0], [100, 100], [0, 100]] |
counting_area_color |
Counting area color | [255, 64, 0] |
classes |
Detection classes | {} |
dataset_create.enable |
Enable dataset creation | true |
dataset_create.probability |
Probability of image saving (0.01–1) | 0.05 |
dataset_create.path |
Path for saving dataset images | yolo_cfg/saved_images/ExampleCam |
recording.enable |
Turn on recording | false |
recording.path |
Video save path | yolo_cfg/saved_recordings |
recording.scale |
Video size (in percent) | 100 |
recording.quality |
Video quality | 80 |
This page displays the video feed along with counters showing the number of detected objects. It is the primary interface for real-time monitoring with recognition results.
URL:
http://127.0.0.1/counter/{location}or
http://127.0.0.1/counter/{location}/videoThis page shows only the counter values without video. It is suitable for low-resource devices or when a simple display of information is required.
URL:
http://127.0.0.1/counter/{location}/textThis view displays two counters simultaneously, which is helpful for monitoring both entry and exit flows.
URL:
http://127.0.0.1/counter_dual/text/{location_first}/{location_second}Contributions to the project are always welcome! To make changes, follow these steps:
- Fork this repository.
- Create a new branch.
git checkout -b feature/your-feature
- Make your changes and commit them.
git commit -m "Added a new feature" - Push your changes.
git push origin feature/your-feature
- Submit a PR (Pull Request) for review.
Before submitting, ensure your changes do not disrupt existing functionality.
- Processor: Modern 4-core processor (e.g., Intel Core i5 or AMD Ryzen 5).
- RAM: At least 8 GB (16 GB or more is recommended for stable video stream processing).
- Storage: SSD for storing datasets and logs.
-
GPU: A GPU significantly speeds up processing and reduces system load. Minimum GPU requirements:
- NVIDIA GTX 1050 (2 GB VRAM): Suitable for low-frame-rate image processing.
- NVIDIA GTX 1660 (6 GB VRAM): Recommended for real-time video streams and high-resolution videos (up to 720p).
- NVIDIA RTX 2060 или выше (6 GB+ VRAM): Stable performance for YOLO models in real-time at resolutions of 1080p and above.
Note: YOLO supports computation on NVIDIA GPUs using CUDA. GPUs from other manufacturers (e.g., AMD) may work but require additional configuration and may have lower performance.
Any device with a web browser capable of running JavaScript.
The core functionality is already implemented, but you can extend the logic by modifying the data processing in the corresponding routes (views).
Check the camera’s functionality and ensure it is correctly connected and streaming in the web interface.
You can run the browser in kiosk mode to prevent users from exiting it. For example, with Google Chrome, you can use the "--kiosk --start-fullscreen" options)
The project is distributed under the AGPL-3.0 license. Details can be found in the LICENSE file.