How rybinsky/prkt works
Project type and purpose
• This is a Python-based open-source tool (“prkt”) for detecting and analyzing parking spaces from a video or camera feed using a YOLOv4-tiny object-detection model.
File structure
• Top-level:
• .gitignore, .pre-commit-config.yaml, README.md, pyproject.toml (packaging and linting)
• prkt/README.md (project docs)
• Python package “prkt/prkt”:
• main.py — entry point and orchestrator
• config/config.yaml + config loader (implicit in utils or config)
• camera.py — abstraction for video or camera inputs
• detector.py — wraps YOLO inference logic
• parking_space.py — logic for defining/managing individual parking slots
• utils.py — shared helpers (logging, image‐processing routines)
• yolo/ — model definition (cfg, weights)
• prkt/tests: skeleton for unit tests
1. Configuration Manager
• Reads config.yaml (paths, thresholds, camera parameters)
2. Camera Input Module
• Captures frames (USB cam, RTSP, video file)
3. YOLO Detector
• Loads yolov4-tiny.cfg & weights
• Runs inference on each frame
• Applies NMS, filters detections
5. Parking-Space Logic
• Maps detections to predefined parking-slot regions
• Determines occupancy state
6. Utilities
• Logging, drawing functions, any file I/O
7. Orchestrator (main.py)
• Glues everything: loads config, instantiates modules, loops over frames, outputs results
b. Data flows and dependencies
• Start → main.py
• main loads Configuration Manager → provides parameters to Camera and Detector
• Camera Module → Frame (raw image) → Detector
• Parking-Space Logic → Occupancy status → Output (console/log/video overlay)
c. Architectural patterns & design principles
• Modular, single-responsibility modules for each major function
• Config-driven behavior: parameters decoupled from code
• Test harness under tests/ for maintainability
d. Key technologies & libraries
• Python 3.x
• OpenCV (cv2) or similar for image I/O
• Darknet Python bindings or PyTorch integration for YOLOv4-tiny
• PyYAML for config parsing
• pytest or unittest for tests
Essential elements to capture
• Configuration loading before runtime
• Model loading (cfg + weights)
• Frame capture loop
• Processing pipeline stages
• Final output mechanism (console log, overlay window, file)
• Test suite location (to show maintainability focus)