{"slug": "automate-surface-defects-detection-with-vision-ai", "title": "Automate Surface Defects Detection with Vision AI", "summary": "Roboflow released a tutorial on automating surface defect detection using computer vision, combining an RF-DETR object detection model with Roboflow Workflows to inspect materials like wood, metal, and glass. The system classifies defects, logs events, and routes products for acceptance, rework, or rejection, aiming to replace manual inspection in manufacturing.", "body_md": "*Computer vision automates surface defect inspection by using object detection models to instantly locate and classify visual irregularities across manufactured materials like wood, metal, and glass. By combining a custom RF-DETR model with automated grading logic in Roboflow Workflows, quality teams can instantly categorize product health, log inspection events, and confidently route or reject defective items on the production line.*\n\nSurface quality affects how a manufactured product looks, performs, and lasts. A small scratch may only reduce the visual quality of a product, while defects like crack, stains, discoloration, blisters, chips, pits etc. can indicate a more serious problem.\n\nTraditionally, surface inspection is performed by people who visually examine products as they move through production. Computer vision can automate part of this process, saves time and converts detections into actions such as:\n\n- Accept the product.\n- Assign it to a lower quality category.\n- Send it for rework.\n- Request manual inspection.\n- Reject it from the production line.\n\nIn this tutorial, I will first explain what a surface defect is, and where computer vision-based surface inspection can be used. I will then explain how to build a practical wood surface defect inspection system using an [RF-DETR NAS](https://rfdetr.roboflow.com/latest/?ref=blog.roboflow.com) object detection model and [Roboflow Workflows](https://roboflow.com/workflows/build?ref=blog.roboflow.com).\n\nThe final Workflow will detect wood defects, count them by severity, display an inspection result on the image, record quality events, and automatically upload uncertain predictions for future model improvement.\n\nSo, let's get started.\n\n## What Are Surface Defects?\n\nSurface defects are visible irregularities, damage, or unwanted variations on the exterior of a material or product. They may appear during:\n\n- Raw-material formation\n- Cutting\n- Casting\n- Rolling\n- Welding\n- Machining\n- Coating\n- Painting\n- Transportation\n- Assembly\n- Storage\n\nA defect may only affect appearance, or it may indicate a structural, functional, or manufacturing problem. Computer vision is especially useful for defects that can be observed from images, including scratches, dents, cracks, blemishes, color differences, and material inconsistencies.\n\n## How Computer Vision Detects Surface Defects\n\nA surface inspection system generally follows this process:\n\nThe most appropriate [computer vision task](https://blog.roboflow.com/key-tasks-in-computer-vision/) depends on what information the application requires. For this tutorial, we use [object detection](https://blog.roboflow.com/object-detection/) because the system needs to locate individual defects and count how many instances of each defect class are visible.\n\n## Where Surface Defect Detection Is Used\n\nSurface defect detection can be applied anywhere a product or material needs to be visually inspected. Computer vision can augment manual inspection by processing images consistently and making the results available to quality-management systems. Following are some use cases.\n\n### Metal Sheet Inspection\n\nMetal sheets can develop scratches, dents, pits, discoloration, coating damage, and other surface defects during manufacturing. A camera can inspect each sheet as it moves along the production line. The system can mark damaged areas and send the sheet for review, rework, or rejection.\n\n*:*\n\n*Read more*[How to Detect Metal Defects with Computer Vision](https://blog.roboflow.com/detect-metal-defects/).\n\n### Printed Circuit Board Inspection\n\nPrinted circuit boards can have small defects such as missing holes, open circuits, short circuits, mouse bites, spurs, and unwanted copper. Computer vision can inspect high-resolution PCB images and locate these defects before the boards are used in electronic products.\n\n*Read more:*[Build a Real-Time PCB Defect Detection System](https://blog.roboflow.com/pcb-defect-detection/).\n\n### Textile and Fabric Inspection\n\nFabric can contain holes, stains, loose threads, cuts, wrinkles, color differences, and other weaving defects. A camera placed above the production line can continuously inspect the fabric and record where each defect appears. Damaged sections can then be repaired, removed, or assigned to a lower-quality product.\n\n### Glass Manufacturing\n\nGlass products can contain scratches, cracks, chips, bubbles, stains, and damaged edges. Computer vision can inspect glass sheets, bottles, windshields, screens, lenses, and solar panels. Controlled lighting is important because reflections may look similar to real defects.\n\n*Read more:*[Glass Inspection with Computer Vision](https://blog.roboflow.com/glass-inspection-with-computer-vision/).\n\n### Ceramic Tile Inspection\n\nCeramic tiles can have cracks, holes, broken edges, chips, stains, or unwanted surface lines. Computer vision can inspect each tile after manufacturing and mark defective tiles before packaging.\n\n*Read more:*[Ceramic Defect Detection with Computer Vision](https://blog.roboflow.com/ceramic-defect-detection/).\n\n### Paint and Coating Defect Inspection\n\nPainted surfaces of many finised products can have scratches, dirt, bubbles, orange peel, peeling, discoloration, or uneven coating. Computer vision can inspect car panels, appliances, metal parts, and painted products to find these defects before final assembly or shipping.\n\n*Read more:*[How to Detect Paint Defects with Computer Vision](https://blog.roboflow.com/detect-paint-defects-with-computer-vision/).\n\n## Tutorial: Build a Wood Surface Defect Detection System with Roboflow\n\nWe will now build a surface inspection application using wood as the practical example. The system uses a trained *RF-DETR NAS object detection model* to detect eight classes:\n\n`Quartzity`\n\n`Live_Knot`\n\n`Marrow`\n\n`Resin`\n\n`Dead_Knot`\n\n`Knot_with_Crack`\n\n`Knot_Missing`\n\n`Crack`\n\nThe application that we are going to buils, performs following tasks:\n\n- Filters predictions using different confidence thresholds for each class.\n- Counts wood surface defects by class.\n- Groups defects into severity categories.\n- Assigns a custom quality decision.\n- Visualizes the result.\n- Records inspection events.\n- Collects uncertain predictions for retraining.\n\n### Step 1: Create the Roboflow Project\n\nCreate a new project in Roboflow and select **Object Detection** as the project type. Give the project a descriptive name, such as `wood-surface-defect-detection`\n\n. Upload images representing the expected operating environment. The dataset should contain:\n\n- Different wood surfaces\n- Different defect sizes\n- Boards with one defect\n- Boards with multiple defects\n- Boards without target defects\n- Different lighting conditions\n- Defects near image boundaries\n- Partially visible defects\n- Similar-looking defect classes\n- Small cracks and irregular knots\n\nNormal images are also important. They teach the model that ordinary grain, color changes, and harmless surface patterns should not always be classified as defects.\n\n*Project Link:*[Wood Surface Defect Detection](https://universe.roboflow.com/tim-4ijf0/wood-surface-defect-detection?ref=blog.roboflow.com)\n\n### Step 2: Annotate the Surface Defects\n\nDraw a bounding box around every visible defect and assign the appropriate class. Use the same class names consistently:\n\nFollow consistent annotation rules:\n\n- Keep each bounding box close to the visible defect.\n- Avoid including large areas of unaffected wood.\n- Annotate every visible instance.\n- Decide whether connected cracks should be one annotation or multiple annotations.\n- Apply the same rule to every image.\n- Review ambiguous knot classes carefully.\n- Leave normal images without bounding-box annotations.\n\nFor small defects, close annotations are particularly important. Large boxes containing mostly normal surface can make it harder for the model to learn the actual visual pattern.\n\n### Step 3: Generate a Dataset Version\n\nAfter annotation, generate a dataset version. Useful preprocessing and augmentation options may include:\n\n- Auto-orientation\n- Resizing\n\n### Step 4: Train an RF-DETR NAS Model\n\nTrain an RF-DETR NAS model using the generated dataset version. RF-DETR is Roboflow’s real-time transformer architecture for object detection and segmentation. Roboflow Neural Architecture Search starts from RF-DETR and searches for candidate architectures that balance predictive performance and inference latency for the dataset and target hardware.\n\n**model by selecting the**\n\n**RF-DETR NAS*** as*\n\n*backbone***. You may try with**\n\n**FAST****or**\n\n**STANDARD****for more accurate models.**\n\n**PLUS** After NAS training, use the Model Explorer to compare candidate models. Select a model based on the requirements of the application:\n\n- Higher accuracy for offline inspection\n- Lower latency for conveyor-belt inspection\n- Smaller architecture for edge deployment\n- Better recall for critical defects\n- A balanced model for general deployment\n\nRoboflow’s NAS interface displays candidate models so that their accuracy and latency trade-offs can be compared.\n\n### Step 5: Evaluate the Model\n\nBefore adding decision logic, test the model on images that were not used during training. Review:\n\n- Precision\n- Recall\n- mAP\n- Confusion matrix\n- Class-wise performance\n- False-positive examples\n- False-negative examples\n- Small-defect performance\n- Predictions on normal wood\n\nPay special attention to confusion between visually related classes such as `Live_Knot`\n\n, `Dead_Knot`\n\n, `Knot_with_Crack`\n\n, `Knot_Missing`\n\n, and also inspect the model’s ability to detect thin cracks. For critical classes, recall may be more important than using a very high confidence threshold.\n\n### Step 6: Create a Roboflow Workflow\n\nIn this step we will build a Wood Surface Defect Inspection and Quality Decision Workflow. Wood inspection is a great example of where computer vision becomes more useful when it goes beyond simply drawing boxes around defects. In this workflow, we use a trained RF-DETR object detection model to find defects on a wood board, then apply a custom decision layer that turns those detections into a practical quality result such as `GRADE_A`\n\n, `GRADE_B`\n\n, `GRADE_C`\n\n, `REWORK`\n\n, `REJECT`\n\n, or `MANUAL_REVIEW`\n\n.\n\nThis workflow is a custom defect-based inspection system. It is not intended to represent or replace any official timber grading standard. Instead, it demonstrates how to combine a trained Roboflow model, post-processing logic, visual annotations, active learning, and event logging into a production-ready quality inspection pipeline.\n\n**What This Workflow Does?**\n\nThe Wood Surface Defect Inspection and Quality Decision System accepts an image of a wooden board and performs the following actions:\n\n- Runs a trained RF-DETR object detection model on the image.\n- Detects eight wood surface defect classes:\n`Quartzity`\n\n`Live_Knot`\n\n`Marrow`\n\n`Resin`\n\n`Dead_Knot`\n\n`Knot_with_Crack`\n\n`Knot_Missing`\n\n`Crack`\n\n- Applies per-class confidence thresholds to remove weak predictions.\n- Counts defects by class and severity group.\n- Applies custom quality decision logic.\n- Draws bounding boxes and labels on the original image.\n- Displays a quality summary directly on the annotated image.\n- Returns structured outputs for downstream systems.\n- Optionally sends results to a webhook.\n- Uploads uncertain predictions back to Roboflow for review and future model improvement.\n- Logs quality inspection events to Vision Events for traceability.\n\nAt a high level, the workflow turns this:\n\n“Here are some defect detections on a wood board.”\n\nInto this:\n\n“This board should be rejected because at least one crack was detected.”\n\nOr:\n\n“This board is Grade B because it has only minor defects and no moderate or critical defects.”\n\n**Workflow Architecture**\n\nThe final [workflow](https://app.roboflow.com/workflows/embed/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ3b3JrZmxvd0lkIjoiaGM1SVBmNTg3ZmUwWVJYbzd1OVoiLCJ3b3Jrc3BhY2VJZCI6InZjQmw1Y0x3bUtQallLTGNRemV1VkE4UlRhNjIiLCJ1c2VySWQiOiJ2Y0JsNWNMd21LUGpZS0xjUXpldVZBOFJUYTYyIiwiaWF0IjoxNzgzOTIyMTUwfQ.wYXtuRqkoQue7E9qCqmD06mNiR2O93QGpTQAFFXAMvw?ref=blog.roboflow.com) looks like following.\n\nLet's understand how I build it.\n\n**Add the Image Input**\n\nWorkflow requires input image or video. Start with an image input block. This block receives the wood surface image that will be inspected.\n\n**Add the RF-DETR Object Detection Model**\n\nNext, add an Object Detection Model block and select the trained RF-DETR NAS model.\n\nSet the model confidence threshold to `0.25`\n\n. This threshold is intentionally low. It allows the model to return lower-confidence predictions. These predictions are useful for the active learning branch, where uncertain detections are uploaded back to Roboflow for review. The production decision path will use stricter class-wise thresholds before making the final inspection decision.\n\n**Add a Per-Class Confidence Filter**\n\nDifferent defect classes may need different confidence thresholds. For example, a thin `Crack`\n\nmay be harder to detect than a large `Live_Knot`\n\n. Add a [Per-Class Confidence Filter](https://inference.roboflow.com/workflows/blocks/per_class_confidence_filter/?ref=blog.roboflow.com) block after the RF-DETR model. Use these starting thresholds:\n\n| Class | Confidence threshold |\n|---|---|\n`Quartzity` |\n0.45 |\n`Live_Knot` |\n0.50 |\n`Marrow` |\n0.45 |\n`Resin` |\n0.40 |\n`Dead_Knot` |\n0.45 |\n`Knot_with_Crack` |\n0.35 |\n`Knot_Missing` |\n0.40 |\n`Crack` |\n0.30 |\n\nOnly detections that pass these thresholds are used for grading and visualization. These thresholds can be adjusted later after testing the model on validation images and real production images.\n\n**Add the Custom Python Grader**\n\nThe main decision logic is handled by a Custom Python block named `wood_defect_grader`\n\n. Connect this block to the filtered predictions from the Per-Class Confidence Filter. The custom Python block does the following:\n\n- Counts each defect class\n- Calculates total defects\n- Calculates critical, moderate, and minor defect counts\n- Assigns the final quality decision\n- Returns pass/fail status\n- Returns detected classes, confidence scores, and coordinates\n\nUse this code in the Custom Python block:\n\n``` python\ndef run(self, predictions):\n    target_classes = [\n        \"Quartzity\",\n        \"Live_Knot\",\n        \"Marrow\",\n        \"Resin\",\n        \"Dead_Knot\",\n        \"Knot_with_Crack\",\n        \"Knot_Missing\",\n        \"Crack\"\n    ]\n\n    # Start count of each class from zero\n    counts = {name: 0 for name in target_classes}\n\n    # Get prediction data\n    class_names = list(predictions.data.get(\"class_name\", []))\n    confidences_raw = predictions.confidence\n    boxes_raw = predictions.xyxy\n\n    detected_classes = []\n    detection_confidences = []\n    detection_coordinates = []\n\n    # Loop through all filtered detections\n    for i in range(len(predictions)):\n        class_name = class_names[i] if i < len(class_names) else \"\"\n\n        # Count class occurrence\n        if class_name in counts:\n            counts[class_name] += 1\n\n        detected_classes.append(class_name)\n\n        # Store confidence\n        if confidences_raw is not None and i < len(confidences_raw):\n            detection_confidences.append(float(confidences_raw[i]))\n        else:\n            detection_confidences.append(0.0)\n\n        # Store bounding box coordinates\n        if boxes_raw is not None and i < len(boxes_raw):\n            x1, y1, x2, y2 = [float(value) for value in boxes_raw[i]]\n\n            detection_coordinates.append({\n                \"class_name\": class_name,\n                \"x_min\": x1,\n                \"y_min\": y1,\n                \"x_max\": x2,\n                \"y_max\": y2\n            })\n\n    # Individual class counts\n    crack_count = counts[\"Crack\"]\n    knot_with_crack_count = counts[\"Knot_with_Crack\"]\n    knot_missing_count = counts[\"Knot_Missing\"]\n    dead_knot_count = counts[\"Dead_Knot\"]\n    resin_count = counts[\"Resin\"]\n    marrow_count = counts[\"Marrow\"]\n    live_knot_count = counts[\"Live_Knot\"]\n    quartzity_count = counts[\"Quartzity\"]\n\n    # Group defects by severity\n    critical_defect_count = (\n        crack_count\n        + knot_with_crack_count\n        + knot_missing_count\n    )\n\n    moderate_defect_count = (\n        dead_knot_count\n        + marrow_count\n        + resin_count\n    )\n\n    minor_defect_count = (\n        live_knot_count\n        + quartzity_count\n    )\n\n    total_defect_count = (\n        critical_defect_count\n        + moderate_defect_count\n        + minor_defect_count\n    )\n\n    # Custom defect-based inspection logic.\n    # This is not an official timber grading standard.\n    if crack_count >= 1:\n        quality_decision = \"REJECT\"\n\n    elif knot_with_crack_count >= 1:\n        quality_decision = \"REJECT\"\n\n    elif knot_missing_count >= 1:\n        quality_decision = \"REWORK\"\n\n    elif total_defect_count == 0:\n        quality_decision = \"GRADE_A\"\n\n    elif dead_knot_count >= 2:\n        quality_decision = \"GRADE_C\"\n\n    elif moderate_defect_count >= 3:\n        quality_decision = \"GRADE_C\"\n\n    elif minor_defect_count <= 2 and moderate_defect_count == 0:\n        quality_decision = \"GRADE_B\"\n\n    else:\n        quality_decision = \"MANUAL_REVIEW\"\n\n    # Convert quality decision into pass/fail for event logging\n    qc_result = (\n        \"pass\"\n        if quality_decision in [\"GRADE_A\", \"GRADE_B\"]\n        else \"fail\"\n    )\n\n    return {\n        \"quality_decision\": quality_decision,\n        \"qc_result\": qc_result,\n\n        \"total_defect_count\": int(total_defect_count),\n        \"critical_defect_count\": int(critical_defect_count),\n        \"moderate_defect_count\": int(moderate_defect_count),\n        \"minor_defect_count\": int(minor_defect_count),\n\n        \"crack_count\": int(crack_count),\n        \"knot_with_crack_count\": int(knot_with_crack_count),\n        \"knot_missing_count\": int(knot_missing_count),\n        \"dead_knot_count\": int(dead_knot_count),\n        \"resin_count\": int(resin_count),\n        \"marrow_count\": int(marrow_count),\n        \"live_knot_count\": int(live_knot_count),\n        \"quartzity_count\": int(quartzity_count),\n\n        \"per_class_counts\": counts,\n        \"detected_classes\": detected_classes,\n        \"detection_confidences\": detection_confidences,\n        \"detection_coordinates\": detection_coordinates\n    }\n```\n\n*How the Grader Works?*\n\nThe Python block groups defects into three severity levels.\n\n| Severity group | Classes |\n|---|---|\n| Critical defects | `Crack` , `Knot_with_Crack` , `Knot_Missing` |\n| Moderate defects | `Dead_Knot` , `Marrow` , `Resin` |\n| Minor defects | `Live_Knot` , `Quartzity` |\n\nThe quality decision is assigned using simple rules:\n\n| Condition | Result |\n|---|---|\nAt least one `Crack` is detected |\n`REJECT` |\nAt least one `Knot_with_Crack` is detected |\n`REJECT` |\nAt least one `Knot_Missing` is detected |\n`REWORK` |\n| No defects are detected | `GRADE_A` |\nTwo or more `Dead_Knot` defects are detected |\n`GRADE_C` |\n| Three or more moderate defects are detected | `GRADE_C` |\n| Up to two minor defects and no moderate defects are detected | `GRADE_B` |\n| Any other case | `MANUAL_REVIEW` |\n\nFor example:\n\n```\nDetected:\n1 Crack\n1 Resin\n\nWorkflow result:\nREJECT\n```\n\nAnother example:\n\n```\nDetected:\n1 Live_Knot\n1 Quartzity\n\nWorkflow result:\nGRADE_B\n```\n\n**Add Visualizations**\n\nAfter the custom grader, add a Bounding Box Visualization block and a Label Visualization block.\n\n**Add a Quality Summary Display**\n\nNow add a Text Display block to write the final inspection result on the image. Use this format:\n\n```\nQUALITY RESULT: {quality_decision}\nTOTAL DEFECTS: {total_defect_count}\nCRITICAL: {critical_defect_count}\nMODERATE: {moderate_defect_count}\nMINOR: {minor_defect_count}\n```\n\nExample output:\n\n```\nQUALITY RESULT: REJECT\nTOTAL DEFECTS: 4\nCRITICAL: 1\nMODERATE: 2\nMINOR: 1\n```\n\nThis gives the inspector one clear image with both visual evidence and the final decision.\n\n**Add Workflow Outputs**\n\nThe Workflow should return the annotated image and structured data. See the configuration below for this block.\n\n**Add an Optional Webhook**\n\nThe Workflow I built for this example include a [Webhook Sink](https://inference.roboflow.com/workflows/blocks/webhook_sink/?ref=blog.roboflow.com) to send the result to an external system. Example JSON payload:\n\n```\n{\n  \"quality_decision\": \"$steps.wood_defect_grader.quality_decision\",\n  \"total_defects\": \"$steps.wood_defect_grader.total_defect_count\",\n  \"critical_defects\": \"$steps.wood_defect_grader.critical_defect_count\",\n  \"moderate_defects\": \"$steps.wood_defect_grader.moderate_defect_count\",\n  \"minor_defects\": \"$steps.wood_defect_grader.minor_defect_count\",\n  \"detected_classes\": \"$steps.wood_defect_grader.detected_classes\"\n}\n```\n\nThe receiving system can then use the result for actions such as:\n\n```\nGRADE_A → Accept\nGRADE_B → Accept as standard quality\nGRADE_C → Downgrade\nREWORK → Send for repair or trimming\nREJECT → Remove from production\nMANUAL_REVIEW → Send to inspector\n```\n\n**Add Vision Events**\n\nAdd a [Roboflow Vision Events](https://inference.roboflow.com/workflows/blocks/roboflow_vision_events/?ref=blog.roboflow.com) block to record inspection results. The event can store:\n\n- Input image\n- Annotated output image\n- Filtered predictions\n- Quality decision\n- Pass/fail result\n- Defect counts\n- Metadata\n\nThe custom Python block returns `qc_result`\n\n, which maps quality decisions like following:\n\n| Quality decision | Event result |\n|---|---|\n`GRADE_A` |\n`pass` |\n`GRADE_B` |\n`pass` |\n`GRADE_C` |\n`fail` |\n`REWORK` |\n`fail` |\n`REJECT` |\n`fail` |\n`MANUAL_REVIEW` |\n`fail` |\n\nThis helps track inspection history over time. For example, you can later review:\n\n- How many boards were rejected?\n- Which defect class appeared most often?\n- How many images needed manual review?\n- How often did cracks appear?\n\n**Add the Uncertain Prediction Branch**\n\nA production model should improve over time. To support this, add an uncertain prediction branch.\n\nThis branch should start from the raw RF-DETR predictions. Use [detection filter](https://inference.roboflow.com/workflows/blocks/detections_filter/?ref=blog.roboflow.com) block to Filter detections with confidence between `0.25`\n\nand `0.50`\n\n.These are predictions where the model is unsure. They are not used directly for the final quality decision. Instead, they are saved for review. Examples of uncertain cases include:\n\n- Small cracks\n- Partial knots\n- Blurred images\n- Poor lighting\n- Unusual wood grain\n- Defects near image edges\n- Similar-looking defect classes\n\nFollowing the configuration of `Operations`\n\nparameter in JSON for detection filter block.\n\n```\n{\n  \"type\": \"roboflow_core/detections_filter@v1\",\n  \"name\": \"uncertain_predictions_filter\",\n  \"predictions\": \"$steps.detect_wood_defects.predictions\",\n  \"operations\": [\n    {\n      \"type\": \"DetectionsFilter\",\n      \"filter_operation\": {\n        \"type\": \"StatementGroup\",\n        \"operator\": \"and\",\n        \"statements\": [\n          {\n            \"type\": \"BinaryStatement\",\n            \"left_operand\": {\n              \"type\": \"DynamicOperand\",\n              \"operand_name\": \"_\",\n              \"operations\": [\n                {\n                  \"type\": \"ExtractDetectionProperty\",\n                  \"property_name\": \"confidence\"\n                }\n              ]\n            },\n            \"comparator\": {\n              \"type\": \"(Number) >=\"\n            },\n            \"right_operand\": {\n              \"type\": \"StaticOperand\",\n              \"value\": 0.25\n            },\n            \"negate\": false\n          },\n          {\n            \"type\": \"BinaryStatement\",\n            \"left_operand\": {\n              \"type\": \"DynamicOperand\",\n              \"operand_name\": \"_\",\n              \"operations\": [\n                {\n                  \"type\": \"ExtractDetectionProperty\",\n                  \"property_name\": \"confidence\"\n                }\n              ]\n            },\n            \"comparator\": {\n              \"type\": \"(Number) <=\"\n            },\n            \"right_operand\": {\n              \"type\": \"StaticOperand\",\n              \"value\": 0.5\n            },\n            \"negate\": false\n          }\n        ]\n      }\n    }\n  ],\n  \"operations_parameters\": {}\n}\n```\n\nAfter filtering uncertain predictions, use a [Property Definition](https://inference.roboflow.com/workflows/blocks/property_definition/?ref=blog.roboflow.com) block to count them.\n\nThen add a [Continue If](https://inference.roboflow.com/workflows/blocks/continue_if/?ref=blog.roboflow.com) block with the condition `uncertain_detection_count >= 1`\n\n. If there are no uncertain predictions, this branch stops. If at least one uncertain prediction exists, send the image to a Roboflow Dataset Upload block. Use tags such as:\n\n```\nuncertain-prediction\nwood-surface-defect-review\n```\n\nThis creates a feedback loop:\n\nThis helps improve the model with real-world examples after deployment.\n\nThe final result is not just a defect detector. It is a full surface inspection Workflow that detects defects, explains the decision visually, logs the inspection, and collects uncertain examples for future model improvement. See the following output how this workflow runs.\n\n## Surface Defects Conclusion\n\nSurface defects are visible problems on a material or product. These defects can affect the appearance, strength, safety, and overall quality of a product. In industries such as manufacturing, electronics, automotive, textiles, glass, metal, and wood processing, detecting surface defects early helps reduce waste, avoid faulty products, and improve customer satisfaction. Computer vision makes surface inspection faster, more consistent, and easier to scale. This helps teams make decisions such as whether a product should be accepted, reviewed, reworked, or rejected.\n\nWith [Roboflow](https://app.roboflow.com/?ref=blog.roboflow.com), building a surface defect detection system becomes more practical. It enables developers and quality teams to move from simple defect detection to a complete visual inspection application that can be improved over time. Start building yours for free today.\n\n**Cite this Post**\n\nUse the following entry to cite this post in your research:\n\n[Timothy M](/author/timothy/). (Jul 13, 2026).\nAutomate Surface Defects Detection with Vision AI. Roboflow Blog: https://blog.roboflow.com/surface-defects/", "url": "https://wpnews.pro/news/automate-surface-defects-detection-with-vision-ai", "canonical_source": "https://blog.roboflow.com/surface-defects/", "published_at": "2026-07-13 15:06:34+00:00", "updated_at": "2026-07-13 15:21:49.446951+00:00", "lang": "en", "topics": ["computer-vision", "artificial-intelligence", "machine-learning", "ai-tools", "ai-products"], "entities": ["Roboflow", "RF-DETR"], "alternates": {"html": "https://wpnews.pro/news/automate-surface-defects-detection-with-vision-ai", "markdown": "https://wpnews.pro/news/automate-surface-defects-detection-with-vision-ai.md", "text": "https://wpnews.pro/news/automate-surface-defects-detection-with-vision-ai.txt", "jsonld": "https://wpnews.pro/news/automate-surface-defects-detection-with-vision-ai.jsonld"}}