Skip to content

Home EN

Aleksandr Kireev edited this page Feb 8, 2026 · 13 revisions

CVCounter Wiki

Welcome to the documentation for the CVCounter project!

Project Description

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.

Key Features:

  • 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

Installation

Method 1: Manual Installation

  1. Clone the repository:
    git clone https://github.com/BespredeL/CVCounter.git
  2. Navigate to the project directory:
    cd CVCounter
  3. Install virtual environment:
    python3 -m venv venv
  4. Activate virtual environment:
    • On Windows:
      .\venv\Scripts\activate
    • On Linux/Mac:
      source venv/bin/activate
  5. Install dependencies:
    pip3 install -r requirements.txt
  6. Rename the configuration file:
    mv config.example.json config.json
  7. Change the parameters in the configuration file, add your YOLO model.
  8. Run the application:
    python app.py

Method 2: Docker Installation

  1. Clone the repository:
    git clone https://github.com/BespredeL/CVCounter.git
  2. Navigate to the project directory:
    cd CVCounter
  3. Build and run using Docker Compose:
    docker-compose up --build

Configuration

All primary configurations are stored in the config.json file.

General Parameters general

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

Server Parameters server

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 *

User Parameters users

Parameter Description Default Value
admin Login and password admin:admin

Database db

Parameter Description Default Value
uri Database connection URI sqlite:///system/database.db
prefix Table prefix ""

Form Parameters form

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"}]

Default Detection Configuration detection_default

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 {}

Default video recording configuration detection_default.recording

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

Detection Configurations detections.ExampleCam

ExampleCam

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

Interface

Main View:

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}/video

Text View:

This 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}/text

Text View with Two Counters:

This 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}

Contributing to the Project

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.


Frequently Asked Questions (FAQ)

1. What are the minimum system requirements for the server?

  • 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.

2. What are the minimum system requirements for the client?

Any device with a web browser capable of running JavaScript.

3. How do I add a new type of counter?

The core functionality is already implemented, but you can extend the logic by modifying the data processing in the corresponding routes (views).

4. What should I do if the video does not display?

Check the camera’s functionality and ensure it is correctly connected and streaming in the web interface.

5. How do I prevent the counting interface from being closed?

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)


License

The project is distributed under the AGPL-3.0 license. Details can be found in the LICENSE file.