Skip to content
Snippets Groups Projects
Commit 8947dade authored by Léo Lozach's avatar Léo Lozach
Browse files

Add README.md

parent 7212c231
No related branches found
No related tags found
No related merge requests found
IRF-PLS
----------------
This project aims to make prediction on image to recognize symbols among 14 symbols. This repository contains pre-generated cnn which allow you to go directly to the third step to make prediction.
### Note
All images must be in png format with `.png` extension. All given folders as inputs can contain file with other formats, they will be ignored.
### Dependencies
This project has been tested on Ubuntu 16.04.1 LTS 64 bits.
python 3.5 x64
tensorflow r0.12
tflearn 0.2.x
numpy 1.12.x
h5py 2.6.x
scipy 0.18.x
### Usage
The first step is to generate the pkl file containing representation of images. Each of these images is converted into a 32*32 matrix which each item contains the three channels value (red, green and blue) normalized between 0 and 1.
The image's label is added in another array.
This huge dataset is separated into a `train` and a `test` datasets. The size of these datasests depends on the `TEST_PERCENTAGE` value you can edit in the `generate_dataset.py` file (default value is `0.1` for 10 % of test images).
`$ python generate_dataset.py --grayscale|--color image_folder dataset_file_output`
* `--grayscale|--color` option indicates wether the images will be saved in grayscale or color mode.
There is no `crop` option available in this mode. We have used pre-cropped images making the grayscaled cnn.
Example:
`$ python generate_dataset.py --grayscale dataset/NicIconExtracted/tav ./dataset.pkl`
You can find two pre-generated datasets respectively in `rgb/dataset.pkl` ad `grayscale/dataset.pkl`
#### Step 2 : Making network
Once your dataset file is generated, you can make your network using a second script. Be careful this step can take several hours to produce the classifier folder. This folder contains very important files. They contain all the convolutional neural networks training. They will be used later when we will make predictions.
`$ python make_network.py dataset_input output_classifier_folder`
Example:
`$ python make_network.py grayscale/dataset.pkl ./classifier`
You can find two pre-generated classifiers respectively in `rgb/classifier` ad `grayscale/classifier`
### Step 3 : Making predictions
When you have your classifier, you are able to make any amount of predictions you want. You just have to give an image file or a folder containing images as input.
This commands allows you to make predictions for a folder :
`$ python evaluate_folder.py --grayscale|--color --crop|--nocrop classifier_folder image_folder`
* `--grayscale|--color` option indicates wether the images will be converted in grayscale or color mode before making prediction.
* `--crop|--nocrop` option indicates wether the input images will be cropped before making prediction.
Example:
`$ python evaluate_folder.py --grayscale --crop grayscale/classifier dataset/evaluationExtracted`
This commands allows you to make predictions for a single file :
`$ python which_symbol.py.py --grayscale|--color --crop|--nocrop classifier_folder image_file`
* `--grayscale|--color` option indicates wether the image will be converted in grayscale or color mode before making prediction.
* `--crop|--nocrop` option indicates wether the input image will be cropped before making prediction.
Example:
`$ python which_symbol.py.py --grayscale --crop grayscale/classifier ./dataset/NicIconExtracted/test/accident_011_10_4_3.png`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment