File size: 4,648 Bytes
efa0ffc
5197766
efa0ffc
 
 
 
 
 
 
5197766
efa0ffc
 
5197766
efa0ffc
5197766
efa0ffc
5197766
efa0ffc
5197766
 
 
 
efa0ffc
5197766
efa0ffc
5197766
 
 
efa0ffc
5197766
efa0ffc
5197766
 
 
 
 
efa0ffc
5197766
efa0ffc
5197766
 
 
 
 
efa0ffc
5197766
 
 
 
 
 
 
 
efa0ffc
 
 
5197766
 
 
 
 
efa0ffc
5197766
efa0ffc
 
 
5197766
 
efa0ffc
 
 
 
5197766
efa0ffc
 
 
5197766
efa0ffc
 
 
5197766
 
 
 
 
 
 
 
 
 
 
 
efa0ffc
 
5197766
efa0ffc
5197766
efa0ffc
5197766
efa0ffc
5197766
 
 
 
 
efa0ffc
5197766
efa0ffc
5197766
 
 
efa0ffc
5197766
 
 
efa0ffc
 
 
5197766
 
 
 
 
efa0ffc
 
 
 
 
 
 
5197766
 
 
 
efa0ffc
 
 
5197766
 
 
 
 
 
 
 
 
 
 
efa0ffc
5197766
efa0ffc
 
 
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
---
title: Rubiks Cube Recognition
emoji: ๐ŸŽฒ
colorFrom: blue
colorTo: red
sdk: gradio
sdk_version: 4.19.2
app_file: app.py
pinned: false
license: apache-2.0
---

# ๐ŸŽฒ Rubik's Cube Recognition with TensorFlow RetinaNet

This is a deep learning model that can recognize and analyze Rubik's cubes in images. The model is built using TensorFlow and RetinaNet architecture for object detection.

## ๐Ÿš€ Features

- **Real-time Detection**: Upload images of Rubik's cubes for instant analysis
- **Multi-class Recognition**: Detect cube faces and 6 different color tiles
- **Interactive Interface**: Simple and intuitive Gradio web interface
- **Advanced AI**: Powered by RetinaNet with SpineNet-49 backbone

## ๐ŸŽฏ How to Use

1. **Upload**: Click "Upload Rubik's Cube Image" and select your image
2. **Analyze**: Click "๐Ÿ” Analyze Image" or wait for automatic processing
3. **Results**: View detection results and visualization with bounding boxes

## ๐Ÿ”ฌ Technical Details

- **Framework**: TensorFlow 2.15+ with Gradio interface
- **Architecture**: RetinaNet with SpineNet-49 backbone
- **Input Size**: 640ร—640 pixels
- **Classes**: 7 total (1 face + 6 color tiles)
- **Colors Detected**: Red, White, Blue, Orange, Green, Yellow

## ๐ŸŒŸ Model Architecture

### RetinaNet-SpineNet-49
- **Base Model**: RetinaNet for object detection
- **Backbone**: SpineNet-49 for feature extraction
- **Input Resolution**: 640ร—640ร—3
- **Output**: Bounding boxes with class predictions and confidence scores

### Detection Classes
1. `face` - Rubik's cube face
2. `red_tile` - Red color tile
3. `white_tile` - White color tile  
4. `blue_tile` - Blue color tile
5. `orange_tile` - Orange color tile
6. `green_tile` - Green color tile
7. `yellow_tile` - Yellow color tile

## ๐Ÿ“Š Performance Metrics

| Metric | Target | Status |
|--------|--------|--------|
| [email protected] | >0.85 | In Training |
| Inference Speed | <100ms | Optimized |
| Accuracy | >90% | Evaluating |

## ๐Ÿ› ๏ธ Local Development

```bash
# Clone the repository
git clone https://huggingface.co/spaces/itsyuimorii/rubiks-cube-recognition
cd rubiks-cube-recognition

# Install dependencies
pip install -r requirements.txt

# Run the application
python app.py
```

## ๐Ÿ“ Project Structure

```
rubiks-cube-recognition/
โ”œโ”€โ”€ app.py                    # Main Gradio application
โ”œโ”€โ”€ requirements.txt          # Python dependencies
โ”œโ”€โ”€ README.md                # This file
โ”œโ”€โ”€ configs/                 # Model configurations
โ”‚   โ””โ”€โ”€ retinanet_config.py
โ”œโ”€โ”€ src/                     # Source code
โ”‚   โ”œโ”€โ”€ data/               # Data processing utilities
โ”‚   โ””โ”€โ”€ model/              # Model training and inference
โ””โ”€โ”€ images/                 # Training and test datasets
    โ”œโ”€โ”€ train/              # Training images and annotations
    โ”œโ”€โ”€ test/               # Test images and annotations
    โ””โ”€โ”€ valid/              # Validation images and annotations
```

## ๐ŸŽฎ Demo Status

โš ๏ธ **Note**: This is a demo version. The complete trained model is currently being developed. The interface will show a preview of the detection capabilities.

## ๐Ÿ“ Dataset Information

- **Format**: COCO annotation format
- **Image Size**: 640ร—640 pixels
- **Training Images**: 50+ annotated cube images
- **Classes**: 7 object classes (face + 6 colors)
- **Annotation Tool**: LabelMe

## ๐Ÿ”ง Training Pipeline

```python
# Training command
python src/model/trainer.py --config configs/retinanet_config.py

# Inference command  
python src/model/visualize.py --image path/to/cube_image.jpg
```

## ๐Ÿค Contributing

Contributions are welcome! Areas for improvement:
- Additional training data
- Model optimization
- UI/UX enhancements
- Performance improvements

## ๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ™ Acknowledgements

- **TensorFlow Model Garden** - RetinaNet implementation
- **SpineNet** - Backbone architecture
- **Gradio** - Web interface framework
- **Hugging Face** - Model hosting and deployment

## ๐Ÿ“ง Contact

- **GitHub**: [@itsyuimorii](https://github.com/itsyuimorii)
- **Hugging Face**: [@itsyuimorii](https://huggingface.co/itsyuimorii)

## ๐Ÿ”— References

- [RetinaNet Paper](https://arxiv.org/abs/1708.02002)
- [SpineNet Architecture](https://arxiv.org/abs/1912.05027)
- [TensorFlow Object Detection API](https://github.com/tensorflow/models/tree/master/research/object_detection)
- [LabelMe Annotation Tool](https://github.com/wkentaro/labelme)

---

*๐ŸŽฒ Ready to solve your Rubik's cube detection challenges!*