Downloads · 30 days
0
Jagannath-cp/Vision4Coil
Vision4Coil is a machine learning model from Jagannath-cp. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
A vision-based system for detecting wire rod coil tails in steel manufacturing using FFT-based temporal gating and instance segmentation. The system identifies informative coil-transition frames via frequency analysis…
Downloads · 30 days
0
Access
Public
Updated Jul 1, 2026
Repo size
2.4 GB
Likes
1
Public
Click a slice to open those files.
.pth1.2 GB · 51%
From the Hugging Face model README
A vision-based system for detecting wire rod coil tails in steel manufacturing using FFT-based temporal gating and instance segmentation. The system identifies informative coil-transition frames via frequency analysis and runs one of three interchangeable deep learning detectors to localise the coil tail.
| File | Description |
|---|---|
FFT_RTSP.py | Main processing pipeline — FFT gating + detector integration + sink abstraction |
detectors.py | Swappable detector classes: YOLODetector, Detectron2Detector, Mask2FormerDetector |
run_on_frames.py | Batch inference script — runs any detector on a folder of validation frames |
webserver.py | Flask web server — streams ROI video + FFT graph to a browser dashboard |
requirements.txt | Python dependencies with install notes for Detectron2 and Mask2Former |
| Folder | Contents |
|---|---|
model_weights/yolov11/ | YOLO11 detection weights (best_latest.pt) |
model_weights/detectron2/ | Detectron2 Mask R-CNN weights (model_final.pth) + config.yaml |
model_weights/mask2former/ | Mask2Former weights (model_0134999.pth) + config.yaml |
demo_inputs/ | Sample input video (10-Coils.mov) and validation frames |
demo_outputs/ | Annotated output images and results.csv per model (generated at runtime) |
python3 -m venv vision_env
source vision_env/bin/activate
# CUDA 12.8 example:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128
pip install opencv-python numpy plotly matplotlib pandas flask ultralytics
Detectron2 must be built from source. Use --no-build-isolation so the build can find your installed PyTorch:
pip install --no-build-isolation git+https://github.com/facebookresearch/detectron2.git
Mask2Former is not pip-installable. Clone it and build the custom CUDA deformable attention ops:
git clone https://github.com/facebookresearch/Mask2Former.git mask2former_repo
cd mask2former_repo/mask2former/modeling/pixel_decoder/ops
python setup.py build install
cd ../../../../..
All scripts that use Mask2Former must be run with:
PYTHONPATH=$PYTHONPATH:mask2former_repo python <script>.py
# YOLO11
python run_on_frames.py --model yolo
# Detectron2 (Mask R-CNN)
PYTHONPATH=$PYTHONPATH:mask2former_repo python run_on_frames.py --model detectron2
# Mask2Former
PYTHONPATH=$PYTHONPATH:mask2former_repo python run_on_frames.py --model mask2former
Optional arguments:
| Argument | Default | Description |
|---|---|---|
--model | yolo | Which detector to use (yolo / detectron2 / mask2former) |
--input | demo_inputs/Validation Dataset | Folder of input frames |
--output | demo_outputs/<model> | Where to save annotated frames + results.csv |
--conf | 0.5 | Confidence threshold |
--weights | model-specific default | Override the default weights path |
Annotated frames (mask overlay + bounding box + confidence) and a summary results.csv are written to the output folder.
Edit the bottom of FFT_RTSP.py:
detector = YOLODetector()
# detector = Detectron2Detector()
# detector = Mask2FormerDetector()
python FFT_RTSP.py
For a live RTSP camera feed, set credentials at the top of FFT_RTSP.py:
USERNAME = "your_username"
PASSWORD = "your_password"
CAMERA_IP = "192.168.1.100"
python webserver.py
# Then open http://localhost:8000
Provides: live ROI video stream, FFT intensity graph, start/stop controls.
The FFT intensity threshold separates coil-motion frames from idle frames. Tune per coil type:
THRESHOLD = 4264.8 # DB16
# THRESHOLD = 3200 # R5.5
# THRESHOLD = 3900 # R8.5
When a segment ≥ 10 s is detected, a timestamped folder is created under output/:
2026_Jul_01-18-22-30_to_18-23-43/
├── *.txt # Frequency intensity over time (tab-separated)
├── *.html # Interactive Plotly graph
├── tail_detected_0.87.jpg # Best frame with mask overlay + bounding box
└── tail_detected_0.87.json # Detection metadata (class, confidence, bbox)
For batch inference (run_on_frames.py), output goes to demo_outputs/<model>/:
demo_outputs/yolo/
├── frame001_pred.jpg # Annotated frame
├── frame002_pred.jpg
└── results.csv # Per-frame detection results