failures-3D-print / README.md
Javiai's picture
Update README.md
fd3cc52
metadata
license: unknown
dataset_info:
  features:
    - name: image_id
      dtype: int64
    - name: image
      dtype: image
    - name: width
      dtype: int64
    - name: height
      dtype: int64
    - name: objects
      struct:
        - name: bbox
          sequence:
            sequence: int64
        - name: categories
          sequence: int64
  splits:
    - name: train
      num_bytes: 3878997
      num_examples: 73
  download_size: 3549033
  dataset_size: 3878997
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
task_categories:
  - object-detection
size_categories:
  - n<1K

Failures in 3D printing Dataset

This is a small dataset of images from failures in 3D print. That idea of this dataset is use for train and object detection model for failures detection on 3D printing.

In the images it detected 4 categories:

  • Error: This refer a any error in the part except the type of error known like spaghetti
  • Extrusor: The base of the extrusor
  • Part: The part is the piece that is printing
  • Spagheti: This is a type of error produced because the extrusor is printing on the air

Structure

The structure of the dataset is

  • image_id: Id of the image
  • image: Image instance in PIL format
  • width: Width of the image in pixels
  • height: Height of the image in pixels
  • objects: bounding boxes in the images
    • bbox: coordinates of the bounding box. The coordinates are [x_center, y_center, bbox width, bbox height]
    • categories: category of the bounding box. The categories are 0: error, 1: extrusor, 2: part and 3: spaghetti

Download the dataset

from datasets import load_dataset

dataset = load_dataset('Javiai/failures-3D-print')

Show the Bounding Boxes

import numpy as np
import os
from PIL import Image, ImageDraw

image = dataset["train"][0]["image"]
annotations = dataset["train"][0]["objects"]
draw = ImageDraw.Draw(image)

categories = ['error','extrusor','part','spagheti']

id2label = {index: x for index, x in enumerate(categories, start=0)}
label2id = {v: k for k, v in id2label.items()}

for i in range(len(annotations["categories"])):
    box = annotations["bbox"][i]
    class_idx = annotations["categories"][i]
    x, y, w, h = tuple(box)
    draw.rectangle((x - w/2, y - h/2, x + w/2, y + h/2), outline="red", width=1)
    draw.text((x - w/2, y - h/2), id2label[class_idx], fill="white")

image