Skip to content

Commit

Permalink
modify README
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketFlash committed Sep 7, 2019
1 parent ebbe371 commit c22bba7
Show file tree
Hide file tree
Showing 6 changed files with 9,231 additions and 9,170 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Siamese and Triplet networks for image classification

This repository contains implementation of a deep neural networks for embeddings learning using Siamese and Triplets approaches with different negative samples mining strategies.
This repository contains Keras implementation of a deep neural networks for embeddings learning using Siamese and Triplets approaches with different negative samples mining strategies.

# Installation

Expand Down Expand Up @@ -83,5 +83,10 @@ Is is also possible to use [test_network.ipynb](https://github.com/RocketFlash/S

Result encodings could be visualized interactively using **plot_tsne_interactive** function in [utils.py](https://github.com/RocketFlash/SiameseNet/blob/master/embedding_net/utils.py).

t-SNE plot of russian traffic sign images embeddings (107 classes):
t-SNE plots of russian traffic sign images embeddings (107 classes)

Before training:
![t-SNE before](images/t-sne_without_training.png)

After training:
![t-SNE example](images/t-sne.png)
9 changes: 6 additions & 3 deletions configs/plates.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
input_shape : [128, 128, 3]
encodings_len: 1024
encodings_len: 256
margin: 0.5
mode : 'triplet'
distance_type : 'l1'
backbone : 'resnet50'
backbone : 'resnext50'
backbone_weights : 'imagenet'
optimizer : 'adam'
optimizer : 'radam'
learning_rate : 0.0001
project_name : 'plates/'
freeze_backbone : True
augmentation_type : 'default'
embeddings_normalization: True

#paths
dataset_path : '/home/rauf/plates_competition/dataset/to_train/'
tensorboard_log_path : 'tf_log/'
weights_save_path : 'weights/'
plots_path : 'plots/'
encodings_path : 'encodings/'
model_save_name : 'best_model_simple2_plates.h5'
Binary file added images/._t-sne_without_training.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/t-sne_without_training.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18,375 changes: 9,214 additions & 9,161 deletions test_network.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@


n_epochs = 1000
n_steps_per_epoch = 600
n_steps_per_epoch = 50
val_batch_size = 8
val_steps = 100

config_name = 'road_signs_resnext50_merged_dataset'
config_name = 'plates'
model = EmbeddingNet('configs/{}.yml'.format(config_name))

initial_lr = 1e-4
Expand All @@ -34,9 +34,9 @@
epochs=n_epochs,
callbacks = callbacks,
val_steps=100,
n_classes=20,
n_classes=2,
n_samples=4,
negative_selection_mode='hardest')
negative_selection_mode='semihard')

model.generate_encodings(save_file_name='encodings_{}.pkl'.format(config_name),
max_num_samples_of_each_classes=30, shuffle=True)
Expand Down

0 comments on commit c22bba7

Please sign in to comment.