1
$\begingroup$

I am benchmarking five different models,

YOLO v2
YOLO v3
Cascade R-CNN
Faster R-CNN
Retina Net

In my comparison, I would like to know what the sizes of each model, to discuss the potential overfitting (if some are larger than others). It can be either the number of layers, the number of parameters. For Yolo models these are stated in the paper, e.g YOLOv2 has 106 layers with 51,000,657 parameters, whereas YOLOv3 has 349 layers and 65,252,682 parameters.

I looked into the other models, but couldn't find similar numbers in their own papers. Therefore, I appreciate if you help me to figure out whether those three are simpler than YOLOs or where they stand in terms of complexity.

$\endgroup$
2
$\begingroup$

If you are researching different architectures, I would recommend you to look at https://www.modelzoo.co/. It contains plenty of links to implementations in different architectures. This can help you get an intuitive understanding of how the models are built via code in case the papers aren't intuitive.

I use PyTorch more so I focused on finding PyTorch implementations. Here are links to Github repositories for the models you listed:

With PyTorch networks, you can count the number of weights/parameters in multiple ways, this StackOverflow question has multiple answers all showing different ways to do it. The simplest one being:

pytorch_total_params = sum(p.numel() for p in model.parameters() if p.requires_grad)

In the post, there are also ways which detail the size of each layer in the network.

$\endgroup$
4
  • $\begingroup$ I am sorry but you post does not address the question at all. $\endgroup$
    – user702846
    May 17 '20 at 18:55
  • 4
    $\begingroup$ With all due respect, I provided you with a link to implementations and a way to programmatically calculate how many layers/weights these models have. Which is exactly what you asked for. The only thing I didn't do was actually give you the number of weights. I just assumed that this was something that you could do yourself. But please, if I somehow misunderstood your request, let me know how I can better help $\endgroup$ May 18 '20 at 7:53
  • $\begingroup$ you can make it better, by putting code, on how to load these models, from scratch, e.g a code for one of the model.s $\endgroup$
    – user702846
    May 23 '20 at 19:28
  • $\begingroup$ Adding code for one of the models wouldn't necessarily help you. Each of these repositories are created by different authors and therefore, have a different structure. I recommend that you look into each repository and see which file contains a class extending "nn.Module", which should likely be the class defining the network's architecture. Importing this class and instantiating it should be enough. You can then follow the code I posted. $\endgroup$ May 23 '20 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.