GithubHelp home page GithubHelp logo

clovaai / symmetrical-synthesis Goto Github PK

View Code? Open in Web Editor NEW
71.0 8.0 12.0 10.43 MB

Official Tensorflow implementation of "Symmetrical Synthesis for Deep Metric Learning" (AAAI 2020)

License: MIT License

Python 100.00%
metric-learning image-retrieval image-clustering deep-learning synthesis cars196 stanford-online-products cub200-2011 aaai2020 tensorflow

symmetrical-synthesis's Introduction

Symmetrical Synthesis for Deep Metric Learning

Official Tensorflow implementation of Symmetrical Synthesis for Deep Metric Learning (AAAI 2020)

Geonmo Gu*, Byungsoo Ko* (* Authors contributed equally.)

@NAVER/LINE Vision

Overview

Symmetrical Synthesis

Symmetrical Synthesis (Symm) is a novel method of synthetic hard sample generation for deep metric learning.

How it Works

After some iterations, symmetrical synthesis generates synthetic points around the class clusters, which are used as hard samples to push the other class with stronger power.

Experimental Results

Getting Started

Requirements

$ pip3 install -r requirements.txt

Prepare Data

  1. Download pretrained GoogleNet model. ref
$ wget https://github.com/Wei2624/Feature_Embed_GoogLeNet/raw/master/tf_ckpt_from_caffe.mat
  1. Download CAR DB and cook.
$ wget http://ai.stanford.edu/~jkrause/car196/car_ims.tgz
$ tar -xzf car_ims.tgz
$ mv car_ims
$ wget http://ai.stanford.edu/~jkrause/car196/cars_annos.mat

# on ../symm_public folder
$ cd dataset
$ python3 cooking_CARS.py --car_folder=/your/car_ims/folder \
--save_path=/your/converted/carDB/will/be/saved/here

Train a Model

  • Available losses: N-pair, Symm + N-pair, Angular, Symm + Angular

Symm + N-pair

$ python3 train.py --backbone=googlenet \
--pretrained_model_path=/your/folder/tf_ckpt_from_caffe.mat \
--image_path=/your/converted/carDB/will/be/saved/here \
--run_gpu=0 \
--save_path=/your/trained/model/will/be/saved/here \
--losses=symm_npair --dim_features=512 \
--input_size=227 --learning_rate=0.0001 \
--decay_steps=5000 --decay_stop_steps=15000 \
--decay_stop_value=0.00001 --decay_ratio=0.5 \
--save_model_steps=100

Test a Model

$ python3 test.py --run_gpu=1 --model_path=/your/trained/model/will/be/saved/here \
--image_path=/your/converted/carDB/will/be/saved/here \
--batch_size=512 --backbone=googlenet \
--pretrained_model_path=/your/folder/tf_ckpt_from_caffe.mat \
--log_path=eval_log_car \
--input_size=227 --start_idx=0 --dim_features=512
  • Best recall@1: 0.77 (0.765 in paper)

Check Test Results

$ tensorboard --logdir=eval_log_car --port=10000

Acknowledgements

Citation

If you find Symmetrical Synthesis useful in your research, please consider to cite the following paper.

@inproceedings{gu2020symmetrical,
    title={Symmetrical Synthesis for Deep Metric Learning},
    author={Geonmo Gu and Byungsoo Ko},
    booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
    year={2020}
}

License

Copyright (c) 2020-present NAVER Corp.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

symmetrical-synthesis's People

Contributors

geonm avatar kobiso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

symmetrical-synthesis's Issues

embedding network architecture

After average pooling the CNN features extracted from the googlenet,

It looks like 'slim.conv2d' was used instead of a fully connected layer.

Then the code in this repository has a different architecture from the original embedding network.

Is this correct?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.