Instructions to use magichampz/lego-technic-sorting-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TF-Keras
How to use magichampz/lego-technic-sorting-model with TF-Keras:
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy), and from_pretrained_keras was removed in huggingface_hub 1.0. # See https://github.com/keras-team/tf-keras for more details. # !pip install "huggingface_hub<1.0" tf_keras from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("magichampz/lego-technic-sorting-model") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from magichampz/lego-technic-sorting-model: direct link, hf CLI and curl.
- Browser
- Download file 3.39 kB
-
https://huggingface.co/magichampz/lego-technic-sorting-model/resolve/main/README.md
- Command line
-
hf download hf://magichampz/lego-technic-sorting-model/README.md
-
curl -L -o README.md https://huggingface.co/magichampz/lego-technic-sorting-model/resolve/main/README.md
3.39 kB
| license: mit | |
| # Model Card for lego-technic-sorting-model | |
| Classification of lego technic pieces under basic room lighting conditions | |
| ## Model Details | |
| ### Model Description | |
| CNN designed from the ground up, without using a pre-trained model to classify images of lego pieces into 7 categories. <br> | |
| Achieved a 93% validation accuracy | |
| - **Developed by:** Aveek Goswami, Amos Koh | |
| - **Funded by:** Nullspace Robotics Singapore | |
| - **Model type:** Convolutional Neural Network (CNN) | |
| ### Model Sources | |
| - **Repository:** https://github.com/magichampz/lego-sorting-machine-ag-ak | |
| ## Uses | |
| The files in the create-model folder are meant to be used on your own computer. | |
| You can train your own deep learning model using your own data and test this model on your computer using testing-tflite-model.py on a single image. | |
| The model was trained on Google Colab, so create_training_data_array.py was used to creata a numpy array file to upload data in the form of a numpy array to Google Colab. | |
| After transfering the tflite model to your Pi, you can then run the image classification file in the raspberry-pi folder to detect and classify lego pieces in real time. | |
| Example of real time object detection and classification: | |
|  | |
| ## Bias, Limitations and Recommendations | |
| The images of the lego pieces used to train the model were taken in room lighting conditions, illuminated with a torchlight. <br> | |
| To use the model, would recommend trying to recreate the conditions and achieve photographs with a similar lighting. <br> | |
| Otherwise, it might be better to retrain the model with a new dataset of images corresponding to your lighting conditions | |
| <!-- This section is meant to convey both technical and sociotechnical limitations. --> | |
| ## Training Details | |
| ### Training Data | |
| - **Data:** https://huggingface.co/datasets/magichampz/lego-technic-pieces <br> | |
| More images can be taken by editing the motion_detection_and_image_classification.py script. | |
| <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. --> | |
| ### Training Procedure | |
| The model was trained using the GPU's available on Google Colab. The jupyter notebook loaded the data from a npy file (in the dataset card), which contained all the images as well as their category labels. | |
| <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. --> | |
| #### Preprocessing | |
| Images were normalized before being fed into the model. Their contrast was also increased using the increase_contrast_more function defined in the notebook attached. | |
| ## Evaluation | |
| ### Results | |
| Our model was trained with 6000 images across 7 different categories of lego technic pieces, split into a 80/20 train/test split. <br> | |
| It achieved 93% testing accuracy and graphs of the accuracy and loss are shown below. <br> | |
| A confusion matrix was also plotted to visualize the performance of the classification algorithm. It depicts the count value of true versus false predictions across each category. | |
|  | |