File size: 2,407 Bytes
6100103
 
3876a17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9889cab
3876a17
 
9889cab
3876a17
 
 
 
 
9889cab
 
 
 
6100103
9889cab
d3c4073
 
4f52eb9
 
 
 
 
 
 
 
d3c4073
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
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
'''