lmb-freiburg / flownet2

FlowNet 2.0: Evolution of Optical Flow Estimation with Deep Networks
https://lmb.informatik.uni-freiburg.de/Publications/2017/IMKDB17/
Other
1k stars 318 forks source link

num_iter/recompute_mean in DataAugmentationLayer #25

Closed sampepose closed 7 years ago

sampepose commented 7 years ago

I am running the FlowNetC deploy model.

What is the purpose of num_iter (aka blobs_[0]) in the DataAugmentationLayer?

From what I can tell, num_iter is initialized to 0 and is incremented with each forward pass of the layer. If num_iter <= recompute_mean, then the mean of the current batch is computed. Otherwise, we don't recalculate the mean, and just use an old mean? Why?

Also, I've found that the code to recompute the mean is never actually run. I placed a LOG(INFO) after if (num_iter <= aug.recompute_mean()) { in data_augmentation_layer.cu and it is never logged. Why is this happening?

"recovered iteration count 1.9491e+06" is logged from data_augmentation_layer.cpp. I don't understand how that number can be so high, we're only doing 1 forward GPU passes per image through the DataAugmentationLayer.

Thanks!

sampepose commented 7 years ago

Just ran this in training mode, and num_iter increments from 0 as expected, so the image mean is calculated correctly.

I've found in data_augmentation_layer.cpp, when adjust_blobs is called in a forward pass, the value coped to blob0 is incorrect.

LOG(INFO) << "before: " << (this->blobs_[0]->mutable_cpu_data())[0];
LOG(INFO) << "assignment: " << (blobs[0]->mutable_cpu_data())[0];
this->blobs_[0]->CopyFrom(*blobs[0],false,true); // Line 172
LOG(INFO) << "after: " << (this->blobs_[0]->mutable_cpu_data())[0];

outputs:

before: 0
assignment: 1.9491e+06
after: 1.9491e+06
nikolausmayer commented 7 years ago

Hi Sam,

Best, Nikolaus

eddy-ilg commented 7 years ago

The mean is "learned" that is, during the first 1000 iterations (parameter recompute_mean) the network computes a running average from the data (this is the learning phase). After that the mean is fixed and never changed again. When loading an existing snapshot the saved mean is used.

sampepose commented 7 years ago

Thanks! Makes sense!