updates readme
This commit is contained in:
parent
6298c177bb
commit
3ef8c74f2e
69
README.md
69
README.md
@ -1,30 +1,14 @@
|
|||||||
# Siamese Neural Network for Keras
|
# Siamese Neural Network for Keras
|
||||||
|
|
||||||
This project provides a lightweight, easy to use and flexible siamese neural network module for use with the Keras
|
This project provides a lightweight siamese neural network module for use with the Keras
|
||||||
framework.
|
framework.
|
||||||
|
|
||||||
Siamese neural networks are used to generate embeddings that describe inter and extra class relationships.
|
The neural network compares two images and returns their similarity in a 0-1 float value.
|
||||||
This makes Siamese Networks like many other similarity learning algorithms suitable as a pre-training step for many
|
The datasets used are the fruit-360 dataset, COCO 2014 and 2017 as well as some ImageNet data.
|
||||||
classification problems.
|
|
||||||
|
|
||||||
An example of the siamese network module being used to produce a noteworthy 99.85% validation performance on the MNIST
|
# Installation
|
||||||
dataset with no data augmentation and minimal modification from the Keras example is provided.
|
|
||||||
|
|
||||||
## Installation
|
- tensorflow
|
||||||
|
|
||||||
Create and activate a virtual environment for the project.
|
|
||||||
```sh
|
|
||||||
$ virtualenv env
|
|
||||||
$ source env/bin/activate
|
|
||||||
```
|
|
||||||
|
|
||||||
To install the module directly from GitHub:
|
|
||||||
```
|
|
||||||
$ pip install git+https://github.com/aspamers/siamese
|
|
||||||
```
|
|
||||||
|
|
||||||
The module will install keras and numpy but no back-end (like tensorflow). This is deliberate since it leaves the module
|
|
||||||
decoupled from any back-end and gives you a chance to install whatever backend you prefer.
|
|
||||||
|
|
||||||
To install tensorflow:
|
To install tensorflow:
|
||||||
```
|
```
|
||||||
@ -36,19 +20,7 @@ To install tensorflow with gpu support:
|
|||||||
$ pip install tensorflow-gpu
|
$ pip install tensorflow-gpu
|
||||||
```
|
```
|
||||||
|
|
||||||
## To run examples
|
- If you use tensorflow-gpu, you'll have to install Cuda and CuDNN.
|
||||||
|
|
||||||
With the activated virtual environment with the installed python package run the following commands.
|
|
||||||
|
|
||||||
To run the mnist baseline example:
|
|
||||||
```
|
|
||||||
$ python mnist_example.py
|
|
||||||
```
|
|
||||||
|
|
||||||
To run the mnist siamese pretrained example:
|
|
||||||
```
|
|
||||||
$ python mnist_siamese_example.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
For detailed usage examples please refer to the examples and unit test modules. If the instructions are not sufficient
|
For detailed usage examples please refer to the examples and unit test modules. If the instructions are not sufficient
|
||||||
@ -114,35 +86,6 @@ siamese_network.fit(x_train, y_train,
|
|||||||
epochs=epochs)
|
epochs=epochs)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Development Environment
|
|
||||||
Create and activate a test virtual environment for the project.
|
|
||||||
```sh
|
|
||||||
$ virtualenv env
|
|
||||||
$ source env/bin/activate
|
|
||||||
```
|
|
||||||
|
|
||||||
Install requirements
|
|
||||||
```sh
|
|
||||||
$ pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
Install the backend of your choice.
|
|
||||||
```
|
|
||||||
$ pip install tensorflow
|
|
||||||
```
|
|
||||||
|
|
||||||
Run tests
|
|
||||||
```sh
|
|
||||||
$ pytest tests/test_siamese.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Development container
|
|
||||||
To set up the vscode development container follow the instructions at the link provided:
|
|
||||||
https://github.com/aspamers/vscode-devcontainer
|
|
||||||
|
|
||||||
You will also need to install the nvidia docker gpu passthrough layer:
|
|
||||||
https://github.com/NVIDIA/nvidia-docker
|
|
||||||
|
|
||||||
## requirements
|
## requirements
|
||||||
|
|
||||||
keras==2.2.4
|
keras==2.2.4
|
||||||
|
Loading…
Reference in New Issue
Block a user