Git Product home page Git Product logo

cc-ai / climategan Goto Github PK

View Code? Open in Web Editor NEW
69.0 69.0 18.0 59.33 MB

Code and pre-trained model for the algorithm generating visualisations of 3 climate change related events: floods, wildfires and smog.

Home Page: https://thisclimatedoesnotexist.com

License: GNU General Public License v3.0

Python 1.33% Shell 0.01% Jupyter Notebook 98.67%
climate-change computer-vision deep-learning domain-adaptation generative-adversarial-network pytorch

climategan's People

Contributors

51n84d avatar adrienju avatar alexhernandezgarcia avatar alexrey88 avatar dependabot[bot] avatar melisandeteng avatar tianyu-z avatar vict0rsch 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

Watchers

 avatar  avatar  avatar  avatar  avatar

climategan's Issues

Evaluate simclr performance

So here's the issue: we need to have a good way to figure out whether pretraining the encoder with simclr is better than the pretrained Deeplabv2. Many options are out there...

  1. I would begin by just comparing the masker's results of the actual BaseEncoder pretrained with simclr and the Deeplabv2 encoder pretrained on Cityscapes. If the results are better with simclr, then it's clear that we should use it and we would have a lighter encoder. If the results are worse, then we could:

  2. Have the same number of parameters for both encoders (BaseEncoder pretrained with simclr and Deeplabv2 pretrained on Cityscapes), which would imply adding layers to BaseEncoder, train the masker with both and compare the results. If the results are similar or better with simclr, then we should use it with the BaseEncoder. If the results are worse, then we could:

  3. Pretrain Deeplabv2 using simclr and our data (do we pretrain it from scratch or from the pretrained one on Cityscapes?), and then compare the masker's results with the pretrained Deeplabv2 on Cityscapes only. If the results are better with simclr, then we keep Deeplabv2 but we add the simclr pretraining.

And to compare the masker's results, what metrics should we use? And do we train the masker while freezing the encoder or fine-tuning it?

So, what's your thoughts? :)

ADVENT use target segmentation?

Currently our ADVENT implementation uses target labels from deeplab v2 as GT to train the "segmentation" (ie masker for us). This is not how they do it in the paper so we should check w/ experiments what's best

clean up classifier

move blocks defined there to blocks.py or use those already existing there like Conv2dBlock

Leverage pairs

With data from the simulated world, we can "mode-collapse" the translator with paired data:

loss = l2(x_aba, x_a) + l2(x_ab, x_b) # x_b is x_a's real transformation, its pair

No adaptation head: discriminate on features

Instead of using A to structure the latent space and make it domain-invariant (in terms of domain adaptation) we can use an output discriminator after S and D for instance to make those representations indiscernable real | sim

Image logging error in depth head

In this PR
There are some issues in logging depth images from the real world (image is repeated) and then there's also a slight issue with colors in the mask images that are logged in comet.
(see this experiment )

How to infer from cropped data

Hey,

when comparing input data and inferred data (for instance l2 reconstruction real <-> cycle_recon) there's a mismatch in dims:

  • input: resized to 256, random crop to 224
  • inferred: 256

How does MUNIT deal with this @adrienju ? output of network is 224?

[classifier] RuntimeError: The size of tensor a (19) must match the size of tensor b (2) at non-singleton dimension 1

Running test_trainer.py I get

Traceback (most recent call last):
  File "test_trainer.py", line 77, in <module>
    trainer.update_g(domain_batch)
  File "../omnigan/trainer.py", line 269, in update_g
    r_loss = self.get_representation_loss(multi_domain_batch)
  File "../omnigan/trainer.py", line 334, in get_representation_loss
    prediction, update_target
  File "../omnigan/trainer.py", line 128, in <lambda>
    self.losses["G"]["tasks"]["s"] = lambda x, y: (x + y).mean()
RuntimeError: The size of tensor a (19) must match the size of tensor b (2) at non-singleton dimension 1

Implementation choices

2 things to keep in mind, which might need some refactoring is:

  1. it is setup for domain translation, which we might need to reconsider
  2. it is setup for pretraining of reprensentations before that of translations

Two data loaders for synthetic images

Currently the code is setup so that there's a separate data loader for synthetic-flooded and synthetic-nonflooded images. As a result, the loaded pairs don't correspond to one another.

Is it worth preserving this structure (and ensuring that the two loaders are shuffling in the same way) or just have one dataloader for the synthetic data?

The fact that we're moving away from "image translation" makes me think the latter is fine. What do you think?

Some images have weird colors

When doing inference, occasionally the generated image has a weird color scheme (maybe the channels are shuffled).

Example:
AB_410

Add Classifier

  • Create real classifier architecture in classifier.py
  • Add / adapt losses in loss.py
  • Add loss computations in trainer.get_representation_loss(...) and trainer.update_c(...)
  • Add appropriate tests in test_classifier.py (for archi) and test_trainer.py(for losses)

Add the WD2 data to the simulated data

We have 500 image pairs (+ masks) that we could be using to supplement our Unity dataset.

The question is now whether this data is similar enough to the Unity dataset to be used in the same domain, or whether it warrants a separate domain.

I feel that given the utter heterogeneity of our real dataset (Mapillary dashcam vs. GSV data vs. user data), it's ok to have a certain amount of heterogeneity in the simulated data too. But this needs to be tested, either by plotting the distribution of Unity vs. WD2 (e.g. embedding them using Inception?) or doing some ablation studies to see how it can complement the Unity data.

About bit conditioning

So bit conditioning is "a way to share weights. Instead of having domain-specific weights, you share weights and "choose" a path according to that domain signal, encoded in the "bit" "

I'm not sure I understand why cond_nc is initialized twice in the SpadeTranslationDecoder, but more importantly, why it would be initialized to 2 when bit-conditioning and 0 else ?

class SpadeTranslationDecoder(SpadeDecoder):
    def __init__(self, latent_shape, opts):
        self.bit = None
        self.use_bit_conditioning = opts.gen.t.use_bit_conditioning
        cond_nc = 4  # 4 domains => 4-channel bitmap
        cond_nc = 2 if self.use_bit_conditioning else 0  # 2 domains => 2-channel bitmap

Domain adaptation for training simclr

Question : to train the encoder with simCLR, should we consider real and simulated data as "the same", or use the classifier, or use only one of the two (real or simulated) ?

refactor code

Generator and Discriminator architectures come from MUNIT and InstaGAN mainly so there are differences in coding styles ; need to standardize things one day

Pathlib error in tests

For some reason I'm getting the error ModuleNotFoundError: No module named 'omnigan' when running run.py as is.

Changing sys.path.append(str(Path(__file__).parent.parent.resolve())) to sys.path.append(str(Path(__file__).resolve().parent.parent)) in all the test programs fixes the problem for me. Is this the case for you guys?

Complete docstrings

Let's make sure all our utils functions (and others) have docstrings, especially desciribing expected types. for instance @tianyu-z can you complete make_json_file ?

update_d

Create multi-scale discriminator architecture from MUNIT in discriminator.py

Fill update_d() in trainer.py just like update_g() is defined meaning splitting cases using representational mode or not

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.