NVIDIA / flownet2-pytorch

Pytorch implementation of FlowNet 2.0: Evolution of Optical Flow Estimation with Deep Networks
Other
3.12k stars 739 forks source link

Why only consider data[0] and target[0] in the forward computation in FlowNet? #19

Closed PkuRainBow closed 6 years ago

PkuRainBow commented 6 years ago

It seems that you only consider the data[0] and target[0] in the loop of the forward computation:

line #260 to line #265 in main.py

 optimizer.zero_grad() if not is_validate else None
 losses = model(data[0], target[0])
 losses = [torch.mean(loss_value) for loss_value in losses] 
 loss_val = losses[0] # Collect first loss for weight update
 total_loss += loss_val.data[0]
 loss_values = [v.data[0] for v in losses]

Shouldn't we consider all the data and their flow?

fitsumreda commented 6 years ago

@PkuRainBow This is not a problem. The data loaders return a list in the form [data_type1, data_type2..], [target_type1, target_type2,..] In this case, there is only one data_type (image) and target_type(optical flow). So, data[0] = data_type1 target[0] = target_type1