A contour segmentation tool for pebbles using YOLO-based AI segmentation. Includes an interactive Gradio web UI and batch-processing mode.
Make sure the following are installed on your system:
To verify installation:
python3 -m pip --version
conda --version- Create a conda environment:
conda create -n pebble_contours python=3.10- Activate the environment and install dependencies:
conda activate pebble_contours
pip install -r requirements.txtTo launch the interactive Gradio interface:
python3 code/serving_gradio/gradio_server.pyYou’ll get a local URL (e.g. http://127.0.0.1:7860) and possibly a temporary public Gradio link.
Features:
- Upload image
- Adjust:
- Confidence threshold
- Minimum area factor
- Inference device (auto / cpu / gpu)
- Download processed image and CSV with:
- Mask_ID
- Centroid_X / Centroid_Y
- Polygon_Coordinates
To process all images in a folder:
python3 code/model_usage/final_inference_version_on_folder.py path/input/folder path/output/folder --confidence 0.6 --area_factor 0.15 --device cpuOutput:
- JPG with visualized masks
- CSV with mask ID, centroid, polygon coordinates
Located in the code/ directory.
check_dataset.py: View YOLO annotationssv_checker.py: Visualize a single imagesv_dataset_annotator.py: Auto-annotate with SAMprueba_inicial.py: OpenCV-only segmentation
yolotrain.py: YOLO training scriptsmooth_dataset.py: Smooths contour labelsselect_frames.py: Filters valid frames from dataset
final_inference_version_on_folder.py: Final batch inferenceinference_v1.py,inference_v2_*.py: Older versions
gradio_server.py: UI web serverinference_yolo_adapter.py: YOLO integration
This project is delivered as-is. For redistribution or commercial use, contact the author or contracting organization.
