Instructions to use Yodazon/3DPrintFailureType with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Yodazon/3DPrintFailureType with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="Yodazon/3DPrintFailureType")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Yodazon/3DPrintFailureType", device_map="auto") - Notebooks
- Google Colab
- Kaggle
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 |
+
|