LeeJunHyun / Image_Segmentation

Pytorch implementation of U-Net, R2U-Net, Attention U-Net, and Attention R2U-Net.
2.68k stars 595 forks source link

Recurrent Unit for Sequences #34

Closed kobotschick closed 1 year ago

kobotschick commented 5 years ago

Hi, I just wonder how the recurrent network learns from the information of the temporal previous images of a sequence. The for loop for the t steps is implemented in the Recurrent_block.

def forward(self,x):
        for i in range(self.t):
            if i==0:
                x1 = self.conv(x)        
            x1 = self.conv(x+x1)
        return x1

I assumed that somewhere the hidden state would be returned to use in the next frame.

LeeJunHyun commented 5 years ago

Hi, @kobotschick . Thank you for your interest about my repo. There are x1 variable, which is fed into next layer by for loop (t times).

zz10001 commented 5 years ago

Hi,@LeeJunHyun I found many function in solver.py such tensor2img compute_accuracyhas not use,and in #===================================== Test =========================# del self.unet del best_unet self.build_model() self.unet.load_state_dict(torch.load(unet_path)) can I delete the above

del self.unet
del best_unet
self.build_model()

just keep self.unet.load_state_dict(torch.load(unet_path)) to test, look forward to you reply. Best, ming

LeeJunHyun commented 5 years ago

Hi, Ming. Thank you for your interest in my codes. I'm sorry that my codes are not well-organized. There are some dummy codes. In cases of dummies, please remove that if you want. Thanks!

zz10001 commented 5 years ago

I get it, thanks for your help! May you have a happy day.