🎯 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

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support