Eric P. Nusbaum
commited on
Commit
·
db15883
1
Parent(s):
0eb1ddc
Initial Commit
Browse files- README.md +145 -0
- onnx/LICENSE +21 -0
- onnx/README.md +24 -0
- onnx/cvexport.manifest +13 -0
- onnx/labels.txt +9 -0
- onnx/metadata_properties.json +22 -0
- onnx/model.onnx +3 -0
README.md
CHANGED
@@ -1,3 +1,148 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
---
|
4 |
+
# JunkWaxHero 🦸♂️
|
5 |
+
|
6 |
+
**JunkWaxHero** is your go-to computer vision model for identifying "Junk Wax" baseball card sets from the golden era of 1980 to 1999. Whether you're a collector, dealer, or enthusiast, JunkWaxHero simplifies the process of cataloging and verifying your collection with high precision and recall. **The purpose of JunkWaxHero is to provide a model that quickly identifies baseball card sets without relying on SaaS-based inference APIs.**
|
7 |
+
|
8 |
+
## 📦 Available Formats
|
9 |
+
|
10 |
+
JunkWaxHero is available in **ONNX** format to cater to different deployment needs and preferences.
|
11 |
+
|
12 |
+
- **ONNX:** Perfect for interoperability across various platforms and optimizing for different hardware accelerators.
|
13 |
+
|
14 |
+
## 📊 Training Details
|
15 |
+
|
16 |
+
- **Training Completion Date:** January 10, 2025, at 1:32:46 PM
|
17 |
+
- **Training Platform:** Azure Custom Vision
|
18 |
+
- **Domain:** General (Compact) [S1]
|
19 |
+
|
20 |
+
### **Overall Performance Metrics**
|
21 |
+
|
22 |
+
| Metric | Value |
|
23 |
+
|-----------|--------|
|
24 |
+
| Precision | 98.8% |
|
25 |
+
| Recall | 98.8% |
|
26 |
+
| mAP | 99.4% |
|
27 |
+
|
28 |
+
## 📁 Dataset
|
29 |
+
|
30 |
+
The training dataset for **JunkWaxHero** was meticulously curated to ensure robustness and versatility. It includes baseball card images captured on multiple different surfaces and backgrounds, with varying zoom levels to simulate real-world conditions. All images adhere to a **4:3 image ratio** to align with modern cell phone portrait modes. The baseball cards in the dataset are **vertically aligned** to maintain consistency during training. Support for **horizontally aligned cards photographed in their horizontal orientation** is planned for future iterations to enhance the model's flexibility.
|
31 |
+
|
32 |
+
## 🎯 Performance Per Set
|
33 |
+
|
34 |
+
JunkWaxHero has been meticulously trained to recognize the following baseball card sets with exceptional accuracy:
|
35 |
+
|
36 |
+
| Year | Set | Included | Precision | Recall | A.P. |
|
37 |
+
|------|------------|:--------:|-----------|--------|-------|
|
38 |
+
| 1984 | Topps | ✅ | 100.0% | 100.0% | 100.0%|
|
39 |
+
| 1987 | Topps | ✅ | 95.8% | 100.0% | 100.0%|
|
40 |
+
| 1989 | Upper Deck | ✅ | 100.0% | 92.3% | 100.0%|
|
41 |
+
| 1989 | Fleer | ✅ | 100.0% | 100.0% | 100.0%|
|
42 |
+
| 1989 | Bowman | ✅ | 100.0% | 94.7% | 94.7% |
|
43 |
+
| 1990 | Topps | ✅ | 100.0% | 100.0% | 100.0%|
|
44 |
+
| 1990 | Donruss | ✅ | 100.0% | 100.0% | 100.0%|
|
45 |
+
| 1991 | Upper Deck | ✅ | 100.0% | 100.0% | 100.0%|
|
46 |
+
| 1993 | Topps | ✅ | 94.7% | 100.0% | 100.0%|
|
47 |
+
|
48 |
+
*Included sets are marked with a ✅, while excluded sets (if any) would be marked with a ❌.*
|
49 |
+
|
50 |
+
## 🚀 Getting Started
|
51 |
+
|
52 |
+
### Repository
|
53 |
+
|
54 |
+
Access the repository on Hugging Face: [https://huggingface.co/enusbaum/JunkWaxHero/](https://huggingface.co/enusbaum/JunkWaxHero/)
|
55 |
+
|
56 |
+
### Installation
|
57 |
+
|
58 |
+
To integrate **JunkWaxHero** into your projects, choose the format that best fits your workflow:
|
59 |
+
|
60 |
+
#### ONNX
|
61 |
+
|
62 |
+
1. **Install ONNX Runtime:**
|
63 |
+
|
64 |
+
```bash
|
65 |
+
pip install onnxruntime
|
66 |
+
```
|
67 |
+
|
68 |
+
2. **Download the ONNX Model:**
|
69 |
+
|
70 |
+
Navigate to the ONNX directory in the repository and download the `model.onnx` file from [https://huggingface.co/enusbaum/JunkWaxHero/tree/main/onnx](https://huggingface.co/enusbaum/JunkWaxHero/tree/main/onnx).
|
71 |
+
|
72 |
+
3. **Load the ONNX Model:**
|
73 |
+
|
74 |
+
```python
|
75 |
+
import onnxruntime as ort
|
76 |
+
import numpy as np
|
77 |
+
|
78 |
+
# Path to the downloaded ONNX model
|
79 |
+
MODEL_PATH = 'path/to/junkwaxhero/onnx/junkwaxhero.onnx'
|
80 |
+
|
81 |
+
# Initialize the ONNX runtime session
|
82 |
+
session = ort.InferenceSession(MODEL_PATH)
|
83 |
+
|
84 |
+
# Get input and output names
|
85 |
+
input_name = session.get_inputs()[0].name
|
86 |
+
output_name = session.get_outputs()[0].name
|
87 |
+
|
88 |
+
# Example function to run inference
|
89 |
+
def predict(image):
|
90 |
+
image = np.expand_dims(image, axis=0).astype(np.float32) # Add batch dimension and ensure correct type
|
91 |
+
predictions = session.run([output_name], {input_name: image})
|
92 |
+
return predictions
|
93 |
+
```
|
94 |
+
|
95 |
+
### Usage
|
96 |
+
|
97 |
+
1. **Prepare Your Images:** Ensure your baseball card images are clear and well-lit for optimal identification. Images should be in a **4:3 ratio** and **vertically aligned**.
|
98 |
+
|
99 |
+
2. **Load the Model:** Use the appropriate code snippet above based on your chosen format (TensorFlow or ONNX).
|
100 |
+
|
101 |
+
3. **Identify Sets:** Pass your images through JunkWaxHero to accurately identify the set they belong to.
|
102 |
+
|
103 |
+
```python
|
104 |
+
from PIL import Image
|
105 |
+
|
106 |
+
# Load and preprocess the image
|
107 |
+
def load_image(image_path):
|
108 |
+
image = Image.open(image_path)
|
109 |
+
image = image.resize((width, height)) # Resize to the input size expected by the model
|
110 |
+
image = np.array(image)
|
111 |
+
return image
|
112 |
+
|
113 |
+
# Example usage
|
114 |
+
image = load_image('path/to/baseball_card.jpg')
|
115 |
+
predictions = predict(image)
|
116 |
+
|
117 |
+
# Get the predicted label
|
118 |
+
predicted_label = labels[np.argmax(predictions)]
|
119 |
+
print(f'Predicted Set: {predicted_label}')
|
120 |
+
```
|
121 |
+
|
122 |
+
> **Note:** Replace `(width, height)` with the actual dimensions expected by your model.
|
123 |
+
|
124 |
+
### Optimization
|
125 |
+
|
126 |
+
Leverage the high precision and recall rates to maintain an organized and verified collection. Depending on your deployment environment, choose between TensorFlow for seamless integration with TensorFlow ecosystems or ONNX for broader platform compatibility and performance optimizations.
|
127 |
+
|
128 |
+
## 🔍 Use Cases
|
129 |
+
|
130 |
+
- **Collectors:** Quickly verify and catalog your baseball card collection.
|
131 |
+
- **Dealers:** Streamline inventory management with accurate set identification.
|
132 |
+
- **Enthusiasts:** Explore and discover sets with ease using advanced computer vision techniques.
|
133 |
+
|
134 |
+
## 🛠️ Technical Details
|
135 |
+
|
136 |
+
JunkWaxHero leverages state-of-the-art computer vision architectures optimized for identifying baseball card sets from images. Trained on a diverse dataset spanning multiple decades, the model ensures robustness and reliability across various card conditions and designs. By offering both TensorFlow and ONNX formats, JunkWaxHero provides flexibility for different deployment scenarios, whether you're integrating into existing TensorFlow pipelines or seeking cross-platform compatibility with ONNX.
|
137 |
+
|
138 |
+
## 📄 License
|
139 |
+
|
140 |
+
This project is licensed under the [MIT License](LICENSE).
|
141 |
+
|
142 |
+
## 📫 Contact
|
143 |
+
|
144 |
+
For questions, suggestions, or support, please reach out to [eric@nusbaum.me](mailto:eric@nusbaum.me).
|
145 |
+
|
146 |
+
---
|
147 |
+
|
148 |
+
*Happy Collecting!*
|
onnx/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) Microsoft Corporation.
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE
|
onnx/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Custom Vision Export Object Detection Models
|
2 |
+
This model is exported from [Custom Vision Service](https://customvision.ai)
|
3 |
+
|
4 |
+
Please visit our [Sample scripts respository](https://github.com/Azure-Samples/customvision-export-samples).
|
5 |
+
|
6 |
+
## Prerequisites
|
7 |
+
(For TensorFlow Lite model) TensorFlow Lite 2.1 or newer
|
8 |
+
|
9 |
+
## Input specification
|
10 |
+
This model expects 320x320, 3-channel RGB images. Pixel values need to be in the range of [0-255].
|
11 |
+
|
12 |
+
## Output specification
|
13 |
+
There are three outputs from this model.
|
14 |
+
|
15 |
+
* detected_boxes
|
16 |
+
The detected bounding boxes. Each bounding box is represented as [x1, y1, x2, y2] where (x1, y1) and (x2, y2) are the coordinates of box corners.
|
17 |
+
* detected_scores
|
18 |
+
Probability for each detected boxes.
|
19 |
+
* detected_classes
|
20 |
+
The class index for the detected boxes.
|
21 |
+
|
22 |
+
# Reference
|
23 |
+
* [Custom Vision Service documentation](https://docs.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/)
|
24 |
+
* [Sample scripts](https://github.com/Azure-Samples/customvision-export-samples)
|
onnx/cvexport.manifest
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"DomainType": "ObjectDetection",
|
3 |
+
"Platform": "ONNX",
|
4 |
+
"Flavor": null,
|
5 |
+
"ExporterVersion": "2.0",
|
6 |
+
"ExportedDate": "2025-01-10T18:55:56.72257Z",
|
7 |
+
"IterationId": "159e9c3e-6435-4b9b-826d-ca39f5889fbc",
|
8 |
+
"ModelFileName": "model.onnx",
|
9 |
+
"LabelFileName": "labels.txt",
|
10 |
+
"MetadataPropsFileName": "metadata_properties.json",
|
11 |
+
"ModelFileSHA1": "949c71d256808ed71dafaeb424f54bd94051857e",
|
12 |
+
"SchemaVersion": "1.0"
|
13 |
+
}
|
onnx/labels.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
1984 Topps
|
2 |
+
1987 Topps
|
3 |
+
1989 Bowman
|
4 |
+
1989 Fleer
|
5 |
+
1989 Upper Deck
|
6 |
+
1990 Donruss
|
7 |
+
1990 Topps
|
8 |
+
1991 Upper Deck
|
9 |
+
1993 Topps
|
onnx/metadata_properties.json
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"CustomVision.Metadata.AdditionalModelInfo": "",
|
3 |
+
"CustomVision.Metadata.Version": "1.2",
|
4 |
+
"CustomVision.Postprocess.Method": "SSD",
|
5 |
+
"CustomVision.Postprocess.Yolo.Biases": "[]",
|
6 |
+
"CustomVision.Postprocess.Yolo.NmsThreshold": "0.0",
|
7 |
+
"CustomVision.Preprocess.CropHeight": "0",
|
8 |
+
"CustomVision.Preprocess.CropMethod": "NoCrop",
|
9 |
+
"CustomVision.Preprocess.CropWidth": "0",
|
10 |
+
"CustomVision.Preprocess.MaxDimension": "0",
|
11 |
+
"CustomVision.Preprocess.MaxScale": "0.0",
|
12 |
+
"CustomVision.Preprocess.MinDimension": "0",
|
13 |
+
"CustomVision.Preprocess.MinScale": "0.0",
|
14 |
+
"CustomVision.Preprocess.NormalizeMean": "[0.0, 0.0, 0.0]",
|
15 |
+
"CustomVision.Preprocess.NormalizeStd": "[1.0, 1.0, 1.0]",
|
16 |
+
"CustomVision.Preprocess.ResizeMethod": "Stretch",
|
17 |
+
"CustomVision.Preprocess.TargetHeight": "320",
|
18 |
+
"CustomVision.Preprocess.TargetWidth": "320",
|
19 |
+
"Image.BitmapPixelFormat": "Rgb8",
|
20 |
+
"Image.ColorSpaceGamma": "SRGB",
|
21 |
+
"Image.NominalPixelRange": "Normalized_0_1"
|
22 |
+
}
|
onnx/model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eba88166ae625c537736423715adc31baf4e7cb0dabbdd76f6ee6cbbcacb969f
|
3 |
+
size 11670194
|