facebookresearch / SparseConvNet

Submanifold sparse convolutional networks
https://github.com/facebookresearch/SparseConvNet
Other
2.04k stars 332 forks source link

How to compute FLOPs for spraseconvnet #235

Closed tangores closed 1 year ago

tangores commented 1 year ago

Great work by the way. I'd like to know how did you evaluate the computation:- FLOPs, could you please advice me on this. Thank you

btgraham commented 1 year ago

A variable forward_pass_multiplyAdd_count in the library namespace is updated every time SparseConvNet does a sparse convolution forward operation with the number of MAC=='multiply-accumulate' steps. Divide by the number of test examples to get the average FLOPs per forward pass. See for example https://github.com/facebookresearch/SparseConvNet/blob/dcf6a7ff540e1825ffe48ba6b2c1493ba18788b2/examples/3d_segmentation/unet.py#L151

Note that unlike a regular ConvNet, the number of FLOPs varies for each test sample depending on the shape and size, so you should look at the average number of flops over a test set.

tangores commented 1 year ago

Thank you so much for your quick reply.

Apologies, I had one more question, is there a script to test the trained model?

Please advice me on this. Thank you.

btgraham commented 1 year ago

Sorry, no. Just the training script is released.