iamukasa / image_classification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image Classifier through transfer learning

####Simple transfer learning with an Inception v3 architecture model which displays summaries in TensorBoard.

This example shows how to take a Inception v3 architecture model trained on ImageNet images, and train a new top layer that can recognize other classes of images.

The top layer receives as input a 2048-dimensional vector for each image. We train a softmax layer on top of this representation. Assuming the softmax layer contains N labels, this corresponds to learning N + 2048*N model parameters corresponding to the learned biases and weights.

Requirements

Dependencies

To install dependenxies you need to run

pip install -r requirements.txt


## Example

Here's an example, which assumes you have a folder containing class-named
subfolders, each full of images for each label. The example folder flower_photos
should have a structure like this:

~/data/hot_dog/photo1.jpg
~/data/hot_dog/photo2.jpg
...
~/data/not_hot_dog/anotherphoto77.jpg
~/data/not_hot_dog/somepicture.jpg
...

The subfolder names are important, since they define what label is applied to
each image, but the filenames themselves don't matter. Once your images are
prepared, you can run the training with a command like this:

```bash
python retrain.py --model_dir ./inception --image_dir data


## Visualisation
To use with TensorBoard:

By default, this script will log summaries to /tmp/retrain_logs directory

Visualize the summaries with this command:

```bash
tensorboard --logdir /tmp/retrain_logs

## Testing
```bash
python retrain_model_classifier.py <full path to image>

About


Languages

Language:Python 100.0%