Are you sure you want to delete this access key?
Legend |
---|
DVC Managed File |
Git Managed File |
Metric |
Stage File |
External File |
Legend |
---|
DVC Managed File |
Git Managed File |
Metric |
Stage File |
External File |
This repository shows how to use TensorFlow to classify images.
When building this model I was especially interested whether the model would be able to classify my own hand drawn and water color painted images correctly.
One of the challenges I was facing when starting with TensorFlow was running it on my local laptop. However, it is possible to run TensorFlow on your local laptop without GPU capability or without connecting to a paid virtual machine directly. In order to do this TensorFlow is run through the tensorflow/tensorflow
Docker container. Below I will describe how you can run TensorFlow on your local laptop.
Assuming you've installed Docker, download the image of the tensorflow/tensorflow
docker container by running the following command line.
docker pull tensorflow/tensorflow
Then, run the Docker container and start a bash
shell session.
Adding the -v to the below command line mounts the host directory where you're running your Docker container to the containers working directory. In this example I'm working in the home/
folder in the container. Specify port 8888:8888 with -p to run jupyter notebook through your shell. Specify a name for the running container by using --name. Adding -it to the command line means the container is running in interactive mode. Finally run the docker container and add bash
at the end.
docker run -it -p 8888:8888 —-name DOCKER_CONTAINER_NAME -v $PWD:/home tensorflow/tensorflow bash
Now you're ready to start using TensorFlow.
Run the TensorFlow CNN model from this repository by running the following in the command line:
make
The model will be stored in the folder model/
.
(If prompted with the error "ImportError: libGL.so.1: cannot open shared object file: No such file or directory" install libgl
with apt install libgl1-mesa-glx
)
The model uses hyperparameter tuning as a part of training the model. After the model is saved in the folder model/
the module predict.py
in the folder flower_types/
lets you predict any image through either an url or from an image downloaded in the folder test/
. The predicted image is then stored in the folder predictions/
.
To try this out I've added a photo of a rose in the tests/
folder and run the following in the command line:
python flower_types/predict.py drawn_tulip.png
The following picture will then appear in the folder predictions/
.
We find that the model predicts this drawing as a dandelion. However, the model was very close to predicting the image as a tulip. 0.24 for the dandelion class versus 0.22 for the tulip class. Given that this model was run on a 32x32 pixelation of the image. I'm very happy with the results :grinning:
Annalie Kruseman
Feel free to contact me for any questions on annaliakruseman@gmail.com
Dataset downloaded from Kaggles ‘Flower Types’ open source dataset
Press p or to see the previous file or, n or to see the next file
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?