10000 GitHub - andrewromanenco/hit-detector-huggingface: Hole/Hit detection model with hugging face wrapper
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

andrewromanenco/hit-detector-huggingface

Repository files navigation

license library_name pipeline_tag tags
mit
hitdetector
image-classification
pytorch
sliding-window
computer-vision
hole-detection
custom-pipeline

🎯 Hit Detector Model

This PyTorch-based CNN detects holes on boards or paper using a sliding window approach. It was trained on image patches of size 24×24. The model scans larger images with this patch size to detect regions of interest.

Holes or defects must approximately fit within a 20×20 region to be accurately detected.

🤗 Model Card on Hugging Face.

🔗 Live Demo

Try the model here: Hit Detector Gradio Demo

📥 Model Inputs & Outputs

  • Input: RGB or grayscale image (PIL.Image)
  • Output: Annotated PIL.Image with red (or specified color) squares highlighting detected holes

Example result

🚀 Quick Start

🧠 Inference in Python

from PIL import Image
from  pipeline  import  HitDetectorPipeline

pipe  =  HitDetectorPipeline("model.pt")

img  = Image.open("input.png")
result  =  pipe(img)
result.save("output.png")
print("✅ Output saved to output.png")

📦 Installation

pip install -r requirements.txt

🧪 Testing in Docker

To test the model or pipeline scripts inside a clean container:

cd <project folder>
docker run -it --rm -p 7860:7860 -v $PWD:/appx:rw romanenco/python-tool-chain /bin/bash
cd /appx
pip install -r requirements.txt
python test_pipeline.py

You should see output.png generated as a result.

🌐 Run Gradio UI

pip install gradio
python app.py

Open http://127.0.0.1:7860 to test the interactive web UI.

🛠 Retrain or Fine-Tune

To retrain the model on your own dataset, use the full pipeline and tools from the main training repo, which includes:

  • 📁 Tools to extract training patches from full images
  • 🧠 Training script
  • 📈 Inference script

📄 License

MIT

576F

About

Hole/Hit detection model with hugging face wrapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0