Update README.md
Browse files
README.md
CHANGED
@@ -18,3 +18,28 @@ Future updates will include
|
|
18 |
- Determine if the image is a 3D print or not
|
19 |
- Determine if the image is during printing or once complete
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
- Determine if the image is a 3D print or not
|
19 |
- Determine if the image is during printing or once complete
|
20 |
|
21 |
+
|
22 |
+
To make an inference
|
23 |
+
|
24 |
+
Classes
|
25 |
+
```
|
26 |
+
class_names = {0: 'good', 1: 'spaghetti', 2: 'stringing', 3: 'underextrusion'}
|
27 |
+
```
|
28 |
+
|
29 |
+
Pre-Process the image using the following python function
|
30 |
+
```
|
31 |
+
def preProcess(image):
|
32 |
+
# Open the image from raw bytes
|
33 |
+
image = Image.open(BytesIO(image)).convert('RGB')
|
34 |
+
|
35 |
+
transform = transforms.Compose([
|
36 |
+
transforms.Resize(227),
|
37 |
+
transforms.CenterCrop(227),
|
38 |
+
transforms.ToTensor(),
|
39 |
+
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
|
40 |
+
])
|
41 |
+
|
42 |
+
input_image = transform(image).unsqueeze(0)
|
43 |
+
return input_image
|
44 |
+
```
|
45 |
+
|