license | library_name | pipeline_tag | tags | |||||
---|---|---|---|---|---|---|---|---|
mit |
hitdetector |
image-classification |
|
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.
Try the model here: Hit Detector Gradio Demo
- Input: RGB or grayscale image (PIL.Image)
- Output: Annotated PIL.Image with red (or specified color) squares highlighting detected holes
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")
pip install -r requirements.txt
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.
pip install gradio
python app.py
Open http://127.0.0.1:7860 to test the interactive web UI.
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
MIT