All Projects → anvoynov → Biggansarewatching

anvoynov / Biggansarewatching

Authors official implementation of "Big GANs Are Watching You" pre-print

Projects that are alternatives of or similar to Biggansarewatching

Stepik Dl Nlp
Материалы мини-курса на Stepik "Нейронные сети и обработка текста"
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Doc Browser
A documentation browser with support for DevDocs, Dash and Hoogle, written in Haskell and QML
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Attalos
Joint Vector Spaces
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Zeroshotknowledgetransfer
Accompanying code for the paper "Zero-shot Knowledge Transfer via Adversarial Belief Matching"
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Prob mbrl
A library of probabilistic model based RL algorithms in pytorch
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Classification Of Hyperspectral Image
Classification of the Hyperspectral Image Indian Pines with Convolutional Neural Network
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Ds With Pysimplegui
Data science and Machine Learning GUI programs/ desktop apps with PySimpleGUI package
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
American Gut
American Gut open-access data and IPython notebooks
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Cirrus
Serverless ML Framework
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Rl Movie Recommender
The purpose of our research is to study reinforcement learning approaches to building a movie recommender system. We formulate the problem of interactive recommendation as a contextual multi-armed bandit.
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Qatm
Code for Quality-Aware Template Matching for Deep Learning
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Fakeimagedetector
Image Tampering Detection using ELA and CNN
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Tutorials
Tutorials on optimization and coding skills
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Tutorials
All of the code for my Medium articles
Stars: ✭ 92 (-2.13%)
Mutual labels:  jupyter-notebook
Bayesian Cognitive Modeling In Pymc3
PyMC3 codes of Lee and Wagenmakers' Bayesian Cognitive Modeling - A Pratical Course
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Ai for everyone
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Satellite imagery python
Sample sample scripts and notebooks on processing satellite imagery
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Story2hallucination
Stars: ✭ 91 (-3.19%)
Mutual labels:  jupyter-notebook
Scikit Learn Classifiers
An introduction to implementing a number of scikit-learn classifiers, along with some data exploration
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook
Text Mining Course
Course Notes for Text Mining - Prof. Peter Organisciak
Stars: ✭ 93 (-1.06%)
Mutual labels:  jupyter-notebook

Big GANs Are Watching You

This repository is the official implementation of Big GANs Are Watching You: Towards Unsupervised Object Segmentation with Off-the-Shelf Generative Models by Andrey Voynov, Stanislav Morozov, and Artem Babenko.
Schematic representation of our approach.

Core steps:

  1. Find the BigBiGAN latent direction responsible for background darkening and foreground lightening;
  2. Sample real images embeddings and generate segmentation masks with their shifts;
  3. Train U-net with that synthetic data.


example of variation along the latent direction

Requirements

python 3.6 or later

torch>=1.4
torchvision>=0.5
tensorboardX
scikit-image
scipy
h5py

at least 12Gb of GPU-memory for batch size 95 (though smaller batch gives competitive result)

For results visualization:

jupyter

Optional for BigBiGAN tf to torch conversion and BigBiGAN embeddings evaluation:

tensorflow_gpu==1.15.2
tensorflow_hub
parse

if troubles – check the authors packages versions in requirements.txt

Training

First run download_all.sh
this scrips downloads:

  • BigBiGAN weights of the original tf-hub model (https://tfhub.dev/deepmind/bigbigan-resnet50/1) ported to pytorch;
  • precalculated BigBiGAN-embeddings for some popular datasets;
  • background darkening and foreground lightening latent directions coefficients.

note that the ImageNet-BigBiGAN-embeddings takes 551Mb.

To train the U-net segmentation model, run this command:

python train_segmentation.py \
    --out "results" \
    --gan_weights "BigGAN/weights/BigBiGAN_x1.pth" \
    --z "embeddings/BigBiGAN_ImageNet_z.npy"
    --bg_direction "BigGAN/weights/bg_direction.pth" \
    --val_images_dir __path_to_images_dir__ \
    --val_masks_dir __path_to_masks_dir__ \

Custom Data

Once you want to use your own images BigBiGAN-embeddings, please run bigbigan_embeddings.ipynb notebook and provide your own data path.

Evaluation

To check the synthetic data / segmentation samples / model metrics, please run inspection.ipynb notebook.

Pre-trained Models

You can download pretrained models here:

  • U-net trained on ImageNet-BigBiGAN embeddings using default parameters.
  • U-net trained on CUB-200-2011-BigBiGAN embeddings using default parameters.
  • U-net trained on Flowers-BigBiGAN embeddings using default parameters.

Results

Our model achieves state-of-the-art results among fully unsupervised methods on many datasets. Check Tables 1, 2, 3 of the original paper for more details. In the tables below we refer our approach as BigBiGAN and E-BigBiGAN.

Object Detection

Saliency Detection

Here are some samples of the model performing on DUTS dataset:

BigBiGAN weights conversion

Once the original BigBiGAN weigths are distributed within tfhub, we also provide the conversion code. See bigbigan2biggan.ipynb. This code is based on this script: https://github.com/ajbrock/BigGAN-PyTorch/blob/master/TFHub/converter.py . Note that BigBiGAN and BigGAN almost share the architecture and we use the author's officially unofficial PyTorch BigGAN implementation.

Licenses

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].