Skip to content
New issue

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

Update MobileNet Model #85

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SIDHARTH-7
Copy link

This PR is to update the Implementation of MobilenetV1 which was implemented in #72 and worked upon by @Aakash-kaushik , @zoq and @kartikdutt18 . The files are named just mobilenet so that we could include further versions in the same files for better readability.

Copy link

mlpack-bot bot commented Feb 26, 2024

Thanks for opening your first pull request in this repository! Someone will review it when they have a chance. In the mean time, please be sure that you've handled the following things, to make the review process quicker and easier:

  • All code should follow the style guide
  • Documentation added for any new functionality
  • Tests added for any new functionality
  • Tests that are added follow the testing guide
  • Headers and license information added to the top of any new code files
  • HISTORY.md updated if the changes are big or user-facing
  • All CI checks should be passing

Thank you again for your contributions! 👍

@SIDHARTH-7
Copy link
Author

@shrit I will add some tests and then we could check the Implementation of Separable Convolution as well on my local machine.
Please check if my current Implementation can be Improved or if it is wrong.

Copy link

mlpack-bot bot commented Mar 28, 2024

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! 👍

@mlpack-bot mlpack-bot bot added the s: stale label Mar 28, 2024
@mlpack-bot mlpack-bot bot closed this Apr 4, 2024
@shrit shrit reopened this Apr 5, 2024
@mlpack-bot mlpack-bot bot removed the s: stale label Apr 5, 2024
Copy link

mlpack-bot bot commented Apr 5, 2024

Thanks for opening your first pull request in this repository! Someone will review it when they have a chance. In the mean time, please be sure that you've handled the following things, to make the review process quicker and easier:

  • All code should follow the style guide
  • Documentation added for any new functionality
  • Tests added for any new functionality
  • Tests that are added follow the testing guide
  • Headers and license information added to the top of any new code files
  • HISTORY.md updated if the changes are big or user-facing
  • All CI checks should be passing

Thank you again for your contributions! 👍

Copy link
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there @SIDHARTH-7, really nice to have this support added. Sorry that this took almost four months to get to. I just have some high-level comments for now; I have not checked the implementation in detail. I know my review is late, but if you are still interested in working on it so much later, let me know what you think. 👍

@@ -0,0 +1,82 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add this file---we could add it to the .gitignore perhaps?

template<
typename MatType = arma::mat
>
class MobileNetType : public MultiLayer<MatType>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a general question about the design. I think it might be cleaner to simply have MobileNetType internally store an FFN that you add the layers to in the constructor. I think several of the other models are built in this way. Is there any particular advantage of this approach that I overlooked? It seems like if you did just hold an FFN internally, you could use default copy/move constructors and operators and reduce the amount of code that you need.

}; // MobileNetType class

// convenience typedef.
typedef MobileNetType<arma::mat> Mobilenet;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
typedef MobileNetType<arma::mat> Mobilenet;
typedef MobileNetType<arma::mat> MobileNet;

model.InputDimensions() = std::vector<size_t>({224, 224, 3});
model.Add<models::Mobilenet>(mobilenetLayer);
ModelDimTest(model, input, 9216, 10);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be really great to add a test for models::MobileNetType<arma::fmat>, just to make sure that the model works with low precision. I think so long as you don't test serialization, that should work just fine.

(The reason serialization would have a problem is because you'd need to register all the arma::fmat layers for serialization. That can add a lot of compile time... but I think it's safe to say that if MobileNet serializes correctly with arma::mat, then it will serialize correctly with arma::fmat, assuming that each layer correctly serializes with arma::fmat. From the perspective of this code, that should be a safe assumption---testing individual layer serialization should be done inside of mlpack's core code.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants