We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm using the following method to calculate parameters and GFLOPs, with an image size of 840x420, img_scale=0.5, and batch size set to 1:
def count_parameters(model): return sum(p.numel() for p in model.parameters() if p.requires_grad) / 1e6 # Convert to million (M) units def calculate_gflops(model, input_tensor): flops, params = profile(model, inputs=(input_tensor, )) return flops ,params input_tensor = torch.randn((1, 3, 420, 240)) num_params = count_parameters(model) gflops = calculate_gflops(model, input_tensor) print(f"Number of parameters: {num_params} M") print(f"GFLOPs: {gflops[0]/1000**3}G") print(f"Params: {gflops[1]/1000**2}M")
Results:
Is this approach correct for estimating the model's parameters and GFLOPs? I would appreciate any feedback or suggestions. Thank you!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm using the following method to calculate parameters and GFLOPs, with an image size of 840x420, img_scale=0.5, and batch size set to 1:
Results:
Is this approach correct for estimating the model's parameters and GFLOPs?
I would appreciate any feedback or suggestions. Thank you!
The text was updated successfully, but these errors were encountered: