Computer vision answers · Mining

How do I detect cracks in drill core samples with computer vision?

Without logging every fracture by hand, tray after tray.

Short answer

Train an instance segmentation model to outline each crack in your core tray photos with Roboflow for free, then count the cracks and measure their length in every tray. Give natural cracks and breaks made by drilling or handling their own classes, so only real fractures end up in your log. Photograph every tray from the same height with a scale bar in frame, so pixel lengths convert to centimeters the same way on every photo.

Roboflow agent · free to start

Skip the setup. Describe your images.

Describe your images and what you need to find. The agent sets up labeling, training and deployment with you.

Key facts

What you need
Core tray photos and a segmentation model trained on your cracks
What you get
Every crack outlined, with a count and length per tray
Image sources
Core tray photos from a core shed camera or phone
Runs on
Cloud API, or a core shed workstation running Docker
Tray of geological core samples under lights and a camera, with digital overlays for crack analysis.

How to build drill core crack detection, step by step

Six steps from a photo of a core tray to every crack counted and measured.

  1. Connect Roboflow to your coding agent, ChatGPT or Codex

    Add the Roboflow MCP server to Claude, Cursor or Gemini CLI, or install the Roboflow plugin in ChatGPT or Codex. Your assistant can then upload and auto-label core photos, start training, build the Workflow and run the model from a prompt, at no extra cost beyond your Roboflow plan.

  2. Photograph core trays the same way every time

    Use a fixed camera stand and even lighting, take one tray per photo, and keep a scale bar in frame. Consistent photos make cracks look the same to the model from tray to tray, and the scale bar turns pixels into centimeters.

  3. Outline every crack, with separate classes for natural cracks and drilling breaks

    Draw a polygon around each crack and give natural cracks and breaks made by drilling or handling their own classes. Roboflow Annotate can pre-label photos with SAM 3, and public crack datasets on Roboflow Universe can give you a head start.

  4. Train an instance segmentation model

    Train an instance segmentation model such as RF-DETR Seg on your labeled core photos with Roboflow Train, and test it on trays from holes it has not seen.

  5. Count and measure the cracks in each tray photo

    Run the model on a tray photo, keep only the crack class, and turn each crack's size into centimeters using the scale bar. The longest side of each crack's box gives an approximate length.

    Python
    import supervision as sv
    from inference import get_model
    
    PIXELS_PER_CM = 12  # from the scale bar in your tray photos
    
    model = get_model("your-project/1")
    result = model.infer("tray_017.jpg", confidence=0.4)[0]
    detections = sv.Detections.from_inference(result)
    cracks = detections[detections.data["class_name"] == "crack"]
    
    lengths = (cracks.xyxy[:, 2:] - cracks.xyxy[:, :2]).max(axis=1) / PIXELS_PER_CM
    print(len(cracks), "cracks, lengths in cm:", lengths.round(1).tolist())
    # 4 cracks, lengths in cm: [6.2, 3.1, 4.8, 1.9]

    Rather not write code? Ask the Roboflow agent to set this up for you

  6. Run every tray and log the results per hole

    Build a Workflow that runs the model on each new tray photo, and run it with Roboflow Deploy. Record the crack count and lengths for each tray against its hole and depth, so you can see where the rock is most fractured.

Why 2 million engineers build on Roboflow

  • Label faster

    Auto-label with SAM 3 or your own model, then fix the misses instead of drawing every box.

  • RF-DETR

    Roboflow’s open-source real-time detection model, built for accuracy (opens in a new tab) on small objects.

  • Logic built in

    Counting, zones, tracking and alerts are ready-made Workflow blocks, so there is less code to write.

  • Your model, your weights

    Use your trained weights on every plan, including free, through the open-source Inference package.

  • Run it anywhere

    Self-host on a workstation, Docker, an on-prem GPU or an edge device, or call the cloud API.