Build with RF-DETR

Build a Defect Detection App Free with RF-DETR

Find cracks, dents, scratches, and erosion on parts and get a pass or fail result. Label images, train RF-DETR free, and deploy it as a workflow.

  • No credit card
  • No ML team required
  • Edge, on-prem or API
RF-DETRLive inference
Automated visual inspection camera system scanning metal parts on a conveyor belt, detecting a scratch defect on one component among passed items.
Representative result. Defect detected on one component

Build a Defect Detection App with Roboflow’s Free RF-DETR

In short

A defect detection app uses computer vision to find flaws like cracks, dents, scratches, and erosion in images of parts, then decides whether each part passes inspection. The model to train for it is RF-DETR, Roboflow's open-source real-time detection model. With Roboflow you label your images, train RF-DETR for free, and deploy it as a workflow that returns an annotated image, a defect count, and a PASS or FAIL result.

How it works

The workflow behind the defect detection app

Use this Defect Detection with RF-DETR workflow: each image goes to an RF-DETR model and a per-class confidence filter, then splits into two tracks. One counts the defects and turns the count into PASS or FAIL, the other draws boxes and labels, and both meet where the verdict is written onto the image. Every block is editable in the low-code builder, and the Roboflow Agent can build it from a description.

Defect Detection with RF-DETR
Returns
  • output_image
  • predictions
  • defect_count
  • inspection_result

How to build a defect detection app with RF-DETR

  1. Open the workflow and add your images

    Click "Use this free template" to copy the workflow into your Roboflow workspace. Upload photos of your parts taken with the camera and lighting you will use in production, including both good parts and defective ones.

  2. Label defects and train RF-DETR

    Use Auto Label to draw boxes for crack, dent, scratch, and erosion, then review and correct them. Train an RF-DETR model on the labeled images and select it in the detect_defects block. You don't need a huge dataset: RF-DETR fine-tunes well on small custom datasets, so start with the defect examples you have and add more as your line finds them. If you have almost no defect examples yet, Roboflow also trains anomaly detection models that learn from images of good parts only.

  3. Tune the thresholds and the pass/fail rule

    Set how confident the model must be for each defect type in filter_by_confidence. Change the rule in pass_fail_result if, for example, a single light scratch should still pass.

  4. Deploy and connect it to your line

    Deploy the workflow as a Serverless Cloud API, or on your own hardware through Inference. Each run returns output_image, inspection_result, defect_count, and predictions for your line or quality system to act on.

Roboflow MCP

Build it from your AI assistant with the Roboflow MCP

Connect the Roboflow MCP Server to Claude, Cursor, or any MCP-compatible assistant and build the whole defect detection app in natural language, without leaving your editor.

Ask an assistant like Claude to search Roboflow Universe for defect datasets, upload and auto-label your part images, and train an RF-DETR model on crack, dent, scratch, and erosion classes. It can then create and run the defect detection workflow on test images and deploy it to your devices.

Paste it into your coding agent and it walks you through the rest. Setting up by hand? The server is https://mcp.roboflow.com/mcp.

Add to Claude (opens in a new tab)

Open the Roboflow listing, select Connect, then sign in to Roboflow. Available on desktop, web and mobile.

Run these commands in your terminal, then sign in to Roboflow. Claude Code CLI has no documented browser install link.

Add to Cursor (opens in a new tab)

Opens the Roboflow plugin listing. Sign in if prompted and confirm the install on Cursor to add MCP and skills.

Add to ChatGPT (opens in a new tab)

Opens the Roboflow plugin listing. Install the plugin and sign in to Roboflow when prompted to connect your account.

Add to Codex (opens in a new tab)

Opens the Roboflow plugin listing shared by ChatGPT and Codex. Install the plugin and sign in to Roboflow when prompted to connect your account.

Then run /mcp auth roboflow in Gemini CLI to sign in. Gemini CLI has no documented browser install link.

What your defect detection app can do

Trained on your data, an RF-DETR model handles the specific, hard-to-catch cases that matter on your line:

  • Tell a hairline crack apart from a machining mark or seam
  • Separate light cosmetic scratches from deeper surface damage
  • Find small dents on curved and reflective metal surfaces
  • Spot erosion and wear along edges and leading surfaces
  • Catch several different defects on the same part in one pass
  • Keep finding defects as part position and lighting shift
Roboflow agent · free to start

Want to customize your defect detection app?

Describe the defect detection app you want in plain English: the part, the defects, and what counts as a fail. The Roboflow Agent finds the data, trains an RF-DETR model, and assembles the workflow for you.

Open source

Roboflow’s RF-DETR is open source, Apache-2.0, and free to use

RF-DETR is an open-source, Apache-2.0 licensed real-time object detection model developed by Roboflow. The rfdetr Python package and most RF-DETR models are free to use, including in commercial products, and you can train and run everything on your own hardware. No account or lock-in required.

  • Apache-2.0 and free

    The rfdetr package, Nano to Large detection, every segmentation size and Keypoint are Apache-2.0 licensed and free to use, including commercially.

  • Install and train locally

    pip install rfdetr on Python 3.10+. Fine-tune on your own data in a few lines and run it entirely on your machine.

  • State of the art on COCO

    RF-DETR is a real-time detector that is SOTA on COCO. RF-DETR-Large reaches 56.5 AP at 6.8 ms on an NVIDIA T4, and uses a DINOv2 backbone.

  • Deploy anywhere

    Export to ONNX or TensorRT and run on GPU, CPU, or NVIDIA Jetson at the edge, or serve it through the Roboflow hosted API.

RF-DETR licence by model size
ModelsLicence
Detection: Nano, Small, Medium, LargeApache-2.0
Segmentation: every size, Nano to 2XLargeApache-2.0
Keypoint (preview)Apache-2.0
Detection: Atto, Femto, Pico, XL, 2XL (rfdetr[plus])PML 1.0: commercial use included on Roboflow; commercial self-hosting needs the Enterprise add-on

RF-DETR vs. other free detectors

A defect detection app has to spot small flaws on every part as it passes, so the model needs to be both accurate and fast. Here is how RF-DETR, fine-tuned on your own defect images, compares for real-time inspection.

RF-DETR vs. other free detectors
ModelTasksBest forLicense
RF-DETRDetection, segmentation (keypoints in preview)Real-time detection you fine-tune on your own data, one model across tasksApache-2.0 (Nano to Large, all segmentation); PML 1.0 (Atto, Femto, Pico, XL, 2XL)
D-FINEDetectionPrecision localization when you do not need to fine-tuneApache-2.0
YOLODetection, segmentation, poseFast CNN-based detection with a large ecosystemAGPL-3.0 (commercial license required for closed-source use)
GroundingDINOOpen-vocabulary detectionFinding objects by text prompt with no training, not real-timeApache-2.0
SAM 2 / SAM 3SegmentationPixel-precise masks; SAM 3 adds text-prompted segmentationApache-2.0 (SAM 2), SAM License (SAM 3)
Florence-2Vision-languageReading, captioning, and OCR on imagesMIT

The takeaway for this app: RF-DETR runs in real time, so it keeps up with parts moving down a line. It fine-tunes well on small custom datasets and is open source, so you can train on your own defect images and run the model wherever you need it.

Build your defect detection app free today

Label, train, and deploy your defect detection app in one place.