I am trying to convert caffemodel weights to pytorch and i am wondering what is num_batches_tracked
in pytorch that is similar to caffe.
Here is my caffe BN
prototxt
layer {
name: "conv5_3_1x1_increase/bn"
type: "BatchNorm"
bottom: "conv5_3_1x1_increase"
top: "conv5_3_1x1_increase"
batch_norm_param {
use_global_stats: true
}
}
layer {
name: "conv5_3_1x1_increase/bn/scale"
type: "Scale"
bottom: "conv5_3_1x1_increase"
top: "conv5_3_1x1_increase"
scale_param {
bias_term: true
}
}
I can convert caffemodel like this
for layer_name, param in caffe_model.items():
if '/bn' in layer_name and '/scale' not in layer_name:
factor = param[2].data[0]
mean = np.array(param[0].data, dtype=np.float32) / factor
variance = np.array(param[1].data, dtype=np.float32) / factor
if '/scale' in layer_name:
gamma = np.array(param[0].data, dtype=np.float32)
beta = np.array(param[1].data, dtype=np.float32)
params[layer_name + '.weight'] = gamma
params[layer_name + '.bias'] = beta
params[layer_name + '.running_mean'] = mean
params[layer_name + '.running_var'] = variance
but pytorch has a variable called num_batches_tracked
and how do i find this in caffe model. ?