You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We received some requests about FLOPs of each model, thus we calculated it and updated our paper.
In this issue, we summarize the detail of our FLOPs calculation.
Our FLOPS calculation is approximate value.
Because
Our calculation is mainly based on THOP, which is not an official PyTorch code. (but popular one)
From this issue and readme of THOP, THOP seems like to calculate MACs instead of FLOPs, thus we just use # MACs * 2 as # FLOPs.
We have some irregular modules, which are not in THOP: GridGenerator and LSTM/LSTMCell.
Thus, we calculate FLOPs of GridGenerator module by this code.
def count_GridGenerator(m):
# size
num_fiducial_point = 20
image_width = 32
image_height = 100
# count calculation # https://arxiv.org/pdf/1904.01906.pdf
# we count euclidian distance (d_ij) as 3 MACs, since euclidian distance (d_ij) is root(square(c_i - c_j))
R = num_fiducial_point * num_fiducial_point * 3 * 3 # 3600, 20x20 (size of R), 3 = square, *, ln, 3 = d_ij
# we count matrix inversion as N^3 MACs
inv_delta_C = (num_fiducial_point + 3) ** 3 # 12167
T = (num_fiducial_point + 3) * (num_fiducial_point + 3) * 2 # 1058
P = image_width * image_height * (num_fiducial_point + 3) * 2 # 147200
total_ops = R + inv_delta_C + T + P # 164025, about 0.164M MACs
m.total_ops += torch.Tensor([int(total_ops)])
Hello,
We received some requests about FLOPs of each model, thus we calculated it and updated our paper.
In this issue, we summarize the detail of our FLOPs calculation.
Our FLOPS calculation is approximate value.
Because
Our calculation is mainly based on THOP, which is not an official PyTorch code. (but popular one)
From this issue and readme of THOP, THOP seems like to calculate MACs instead of FLOPs, thus we just use # MACs * 2 as # FLOPs.
We have some irregular modules, which are not in THOP: GridGenerator and LSTM/LSTMCell.
Thus, we calculate FLOPs of GridGenerator module by this code.
and calculate FLOPs of LSTM by this code.
We attached our modified profile code of THOP and we simply use the below code to calculate FLOPs.
If you found some issues, please let us know.
Best.
The text was updated successfully, but these errors were encountered: