GithubHelp home page GithubHelp logo

alexhex7 / simgan_pytorch Goto Github PK

View Code? Open in Web Editor NEW
41.0 41.0 9.0 14.92 MB

[Refer to wayaai/SimGAN(Keras&Tensorflow)] Implementation of Apple's Learning from Simulated and Unsupervised Images through Adversarial Training

Python 100.00%
deeplearning pytorch simgan simgan-pytorch

simgan_pytorch's People

Contributors

alexhex7 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

Watchers

 avatar

simgan_pytorch's Issues

Did you progress in training?

Hi @AlexHex7

I am interested in your implementation. But I am also interested if you achived new results from the shown on the Github page? Did you achieve the same results as from the paper?

Is this line wrong?

https://github.com/AlexHex7/SimGAN_pytorch/blob/654099b7428c4c75ee4e242a1611f580f5d5e4f9/main.py#L197
Shouldn't it be acc_adv = calc_acc(d_ref_pred, 'refine') instead?

Bug in ImageHistoryBuffer implementation

I did some training using this repo and the results are not very satisfactory. After a closer look at the code I found a bug in the ImageHistoryBuffer implementation :

np.append(self.image_history_buffer, images[:nb_to_add], axis=0)

Per np.append

Returns
appendndarray
A copy of arr with values appended to axis. Note that append does not occur in-place: a new array is allocated and filled. If axis is None, out is a flattened array.

The function call itself won't modify the source array and the image buffer will never be filled with anything. This can be verified by printing the buffer size during training.

Here's a fix and modification for better efficiency (list.extend is done in-place to avoid copying the entire image buffer).

class ImageHistoryBuffer(object):
    def __init__(self, max_size, batch_size):
        self.image_history_buffer = []
        self.max_size = max_size
        self.batch_size = batch_size

    def add_to_buffer(self, images, num_to_add=None):
        if not num_to_add:
            num_to_add = self.batch_size // 2
        images = images.tolist()
        if len(self.image_history_buffer) < self.max_size:
            num_to_add = min(num_to_add, self.max_size - len(self.image_history_buffer))
            self.image_history_buffer.extend(images[:num_to_add])
        elif len(self.image_history_buffer) == self.max_size:
            self.image_history_buffer[:num_to_add] = images[:num_to_add]
        else:
            assert False, "Image history buffer overflow"

        random.shuffle(self.image_history_buffer)

    def get_from_buffer(self, num_to_get=None):
        if not num_to_get:
            num_to_get = self.batch_size // 2

        try:
            return np.array(self.image_history_buffer[:num_to_get], dtype=np.float32)
        except IndexError:
            return np.zeros(shape=0)

Hope this helps!

Problems of the training curve

Hi, AlexHex7.
I forked your code and did several changes for bug fixing and speed-up.
But my training procedure wasn't pleasant. I tested many hyper-parameters but the results were still terrible. Could you share your training log with me? Thanks a lot.

Size of Real Image & Synthetic Image not matching

You put an assert statement to check , if size of real images and synthetic images are matching
for pre training Discriminator , but the sizes are different

128 != 52 , because of this it is throwing an error.

Why is that necessary ? How do I fix the error ? Am I working with wrong dataset ?

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.