top of page

Proof Of Concept/Example

Abstract Lines

Github Repository containing all the code

The repo contains all of the files used to create the framework as well as the example that will be demonstrated below. To use the framework simply clone the repository and use the base python files.

1. Creating the datasets

The first step when using the image-rec framework is generating the raw datasets based on the project goals. For the example we create datasets for apple, banana and watermelon.

This will create 3 directories named after their respective labels. In this scenario each directory had about 1200-1400 images.

2. Cleaning the datasets

Many of the gathered images will have issues. Some may be unclear, others not applicable and some not having any relation to the goal.

This line is specifically for the apples folder but had to be performed on every dataset. 6 images will be loaded in at a time- speeding up the cleaning process. After which about 800 images remained in each dataset.

3. Balancing the datasets

For this scenario the datasets were balanced so there was no need to re use any images. If that were not the case salt and peppering / rotation could be used.

The first line will take the first 50 images of the dataset and duplicate them with noise. The second line will rotate duplicate rotated images of the last 50 images. This creates the illusion of having 100 new images for the neural network to learn.

4. Prepping for learning

When the datasets are ready they need to be converted into a ML-ready format. This can be done various ways but the framework provides a simple to_npy function.

4. Training with the provided model

Other models can be used but the framework is provided with a base model for easy testing.

Code will load in the npy file created before. Split up the labels accordingly and use the fit_model function to train. The fit_model function has a built in autosave feature to track progress.

5. Prediction

The trained model is now ready for deployment. In this scenario the model acheived about 93% accuracy on the test_ims images.

The code loads in the pretrained model and then makes predictions based on each image. It will then output the results.

bottom of page