Retrieval.pytorch - The code we used in [2020 DIGIX]

Overview

retrieval.pytorch

dependence

  • python3
  • pytorch
  • numpy
  • scikit-learn
  • tqdm
  • yacs

You can install yacs by pip. Other dependencies can be installed by 'conda'.

prepare dataset

first, you need to download the dataset from here. Then, you can move them into the directory $DATASET and decompress them by

unzip train_data.zip
unzip test_data_A.zip
unzip test_data_B.zip

Then remove the empty directory in train_data:

cd train_data
rm -rf DIGIX_001453
rm -rf DIGIX_001639
rm -rf DIGIX_002284

Finally, you need to edit the file src/dataset/datasets.py and set the correct values for traindir, test_A_dir, test_B_dir.

traindir = '$DATASET/train_data'
test_A_dir = '$DATASET/test_data_A'
test_B_dir = '$DATASET/test_data_B'

Train the network to extract feature

You can train dla102x and resnet101 by the below comands.

python experiments/DIGIX/dla102x/cgd_margin_loss.py
python experiments/DIGIX/resnet101/cgd_margin_loss.py

To train fishnet99, hrnet_w18 and hrnet_w30, you need to download their imagenet pretrained weights from here. Specifically, download fishnet99_ckpt.tar for fishnet99, download hrnetv2_w18_imagenet_pretrained.pth for hrnet_w18, download hrnetv2_w30_imagenet_pretrained.pth for hrnet_w30. Then you need to move these weights to ~/.cache/torch/hub/checkpoints to make sure torch.hub.load_state_dict_from_url can find them.

Then, you can train fishnet99, hrnet_w18, hrnet_w30 by

python experiments/DIGIX/fishnet99/cgd_margin_loss.py
python experiments/DIGIX/hrnet_w18/cgd_margin_loss.py
python experiments/DIGIX/hrnet_w30/cgd_margin_loss.py

After Training, the model weights can be found in results/DIGIX/{model}/cgd_margin_loss/{time}/transient/checkpoint.final.ckpt. We also provide these weights file.

extract features for retrieval

You can download the pretrained model from here and move them to pretrained directory.

Then, run the below comands.

python experiments/DIGIX_test_B/dla102x/cgd_margin_loss_test_B.py
python experiments/DIGIX_test_B/resnet101/cgd_margin_loss_test_B.py
python experiments/DIGIX_test_B/fishnet99/cgd_margin_loss_test_B.py
python experiments/DIGIX_test_B/hrnet_w18/cgd_margin_loss_test_B.py
python experiments/DIGIX_test_B/hrnet_w30/cgd_margin_loss_test_B.py

When finished, the query feature for test_data_B can be found in results/DIGIX_test_B/{model}/cgd_margin_loss_test_B/{time}/query_feat. And the gallery feature can be found in results/DIGIX_test_B/{model}/cgd_margin_loss_test_B/{time}/gallery_feat.

Post process

You can download features from here. Then, you can put it into the directory features and decompress the files by

tar -xvf DIGIX_test_B_dla102x_5088.tar
tar -xvf DIGIX_test_B_fishnet99_5153.tar
tar -xvf DIGIX_test_B_hrnet_w18_5253.tar
tar -xvf DIGIX_test_B_hrnet_w30_5308.tar
tar -xvf DIGIX_test_B_resnet101_5059.tar

Then the features directory will be organized like this:

|-- DIGIX_test_B_dla102x_5088.tar  
|-- DIGIX_test_B_fishnet99_5153.tar  
|-- DIGIX_test_B_hrnet_w18_5253.tar  
|-- DIGIX_test_B_hrnet_w30_5308.tar  
|-- DIGIX_test_B_resnet101_5059.tar 
|-- DIGIX_test_B_dla102x_5088  
| |-- gallery_feat  
| |-- query_feat  
|-- DIGIX_test_B_fishnet99_5153  
| |-- gallery_feat  
| |-- query_feat  
|-- DIGIX_test_B_hrnet_w18_5253  
| |-- gallery_feat  
| |-- query_feat  
|-- DIGIX_test_B_hrnet_w30_5308  
| |-- gallery_feat  
| |-- query_feat  
|-- DIGIX_test_B_resnet101_5059  
| |-- gallery_feat  
| |-- query_feat  

Now, post process can be executed by

python post_process/rank.py --gpu 0 features/DIGIX_test_B_fishnet99_5153 features/DIGIX_test_B_dla102x_5088 features/DIGIX_test_B_hrnet_w18_5253 features/DIGIX_test_B_hrnet_w30_5308 features/DIGIX_test_B_resnet101_5059
Owner
Guo-Hua Wang
Guo-Hua Wang
Offical implementation for "Trash or Treasure? An Interactive Dual-Stream Strategy for Single Image Reflection Separation".

Trash or Treasure? An Interactive Dual-Stream Strategy for Single Image Reflection Separation (NeurIPS 2021) by Qiming Hu, Xiaojie Guo. Dependencies P

Qiming Hu 31 Dec 20, 2022
Easy-to-use micro-wrappers for Gym and PettingZoo based RL Environments

SuperSuit introduces a collection of small functions which can wrap reinforcement learning environments to do preprocessing ('microwrappers'). We supp

Farama Foundation 357 Jan 06, 2023
πŸ“š A collection of Jupyter notebooks for learning and experimenting with OpenVINO πŸ‘“

A collection of ready-to-run Python* notebooks for learning and experimenting with OpenVINO developer tools. The notebooks are meant to provide an introduction to OpenVINO basics and teach developers

OpenVINO Toolkit 840 Jan 03, 2023
A stock generator that assess a list of stocks and returns the best stocks for investing and money allocations based on users choices of volatility, duration and number of stocks

Stock-Generator Please visit "Stock Generator.ipynb" for a clearer view and "Stock Generator.py" for scripts. The stock generator is designed to allow

jmengnyay 1 Aug 02, 2022
StyleGAN-Human: A Data-Centric Odyssey of Human Generation

StyleGAN-Human: A Data-Centric Odyssey of Human Generation Abstract: Unconditional human image generation is an important task in vision and graphics,

stylegan-human 762 Jan 08, 2023
Introduction to CPM

CPM CPM is an open-source program on large-scale pre-trained models, which is conducted by Beijing Academy of Artificial Intelligence and Tsinghua Uni

Tsinghua AI 136 Dec 23, 2022
RuDOLPH: One Hyper-Modal Transformer can be creative as DALL-E and smart as CLIP

[Paper] [Π₯Π°Π±Ρ€] [Model Card] [Colab] [Kaggle] RuDOLPH 🦌 πŸŽ„ β˜ƒοΈ One Hyper-Modal Tr

Sber AI 230 Dec 31, 2022
Galaxy images labelled by morphology (shape). Aimed at ML development and teaching

Galaxy images labelled by morphology (shape). Aimed at ML debugging and teaching.

Mike Walmsley 14 Nov 28, 2022
A hybrid SOTA solution of LiDAR panoptic segmentation with C++ implementations of point cloud clustering algorithms. ICCV21, Workshop on Traditional Computer Vision in the Age of Deep Learning

ICCVW21-TradiCV-Survey-of-LiDAR-Cluster Motivation In contrast to popular end-to-end deep learning LiDAR panoptic segmentation solutions, we propose a

YimingZhao 103 Nov 22, 2022
This repository contains various models targetting multimodal representation learning, multimodal fusion for downstream tasks such as multimodal sentiment analysis.

Multimodal Deep Learning πŸŽ† πŸŽ† πŸŽ† Announcing the multimodal deep learning repository that contains implementation of various deep learning-based model

Deep Cognition and Language Research (DeCLaRe) Lab 398 Dec 30, 2022
style mixing for animation face

An implementation of StyleGAN on Animation dataset. Install git clone https://github.com/MorvanZhou/anime-StyleGAN cd anime-StyleGAN pip install -r re

Morvan 46 Nov 30, 2022
Extreme Rotation Estimation using Dense Correlation Volumes

Extreme Rotation Estimation using Dense Correlation Volumes This repository contains a PyTorch implementation of the paper: Extreme Rotation Estimatio

Ruojin Cai 29 Nov 18, 2022
Unsupervised MRI Reconstruction via Zero-Shot Learned Adversarial Transformers

Official TensorFlow implementation of the unsupervised reconstruction model using zero-Shot Learned Adversarial TransformERs (SLATER). (https://arxiv.

ICON Lab 22 Dec 22, 2022
Code and real data for the paper "Counterfactual Temporal Point Processes", available at arXiv.

counterfactual-tpp This is a repository containing code and real data for the paper Counterfactual Temporal Point Processes. Pre-requisites This code

Networks Learning 11 Dec 09, 2022
Unsupervised Image to Image Translation with Generative Adversarial Networks

Unsupervised Image to Image Translation with Generative Adversarial Networks Paper: Unsupervised Image to Image Translation with Generative Adversaria

Hao 71 Oct 30, 2022
PyTorch implementation of "Optimization Planning for 3D ConvNets"

Optimization-Planning-for-3D-ConvNets Code for the ICML 2021 paper: Optimization Planning for 3D ConvNets. Authors: Zhaofan Qiu, Ting Yao, Chong-Wah N

Zhaofan Qiu 2 Jan 12, 2022
Robotics with GPU computing

Robotics with GPU computing Cupoch is a library that implements rapid 3D data processing for robotics using CUDA. The goal of this library is to imple

Shirokuma 625 Jan 07, 2023
License Plate Detection Application

LicensePlate_Project πŸš— πŸš™ [Project] 2021.02 ~ 2021.09 License Plate Detection Application Overview 1. 데이터 μˆ˜μ§‘ 및 라벨링 μ°¨λŸ‰ 번호판 이미지λ₯Ό 직접 μˆ˜μ§‘ν•˜μ—¬ 각 이미지에 λŒ€ν•΄ '번호판

4 Oct 10, 2022
GitHub repository for the ICLR Computational Geometry & Topology Challenge 2021

ICLR Computational Geometry & Topology Challenge 2022 Welcome to the ICLR 2022 Computational Geometry & Topology challenge 2022 --- by the ICLR 2022 W

42 Dec 13, 2022
Face Transformer for Recognition

Face-Transformer This is the code of Face Transformer for Recognition (https://arxiv.org/abs/2103.14803v2). Recently there has been great interests of

Zhong Yaoyao 153 Nov 30, 2022