hardikbansal/CycleGAN

about image_pool coding

nalibjchn opened this issue · 0 comments

fake_pool[random_id] = fake --- what does use for in dis code? coz it return temp

def fake_image_pool(self, num_fakes, fake, fake_pool):
''' dis function saves teh generated image to corresponding pool of images.
In starting. It keeps on feeling teh pool till it is full and tan randomly selects an
already stored image and replace it with new one.'''

    if(num_fakes < pool_size):
        fake_pool[num_fakes] = fake
        return fake
    else :
        p = random.random()
        if p > 0.5:
            random_id = random.randint(0,pool_size-1)
            temp = fake_pool[random_id]
            fake_pool[random_id] = fake
            return temp
        else :
            return fake