Skip to content

Add support for Mobilenet v2 in Image Classification transfer learning #4351

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

Merged
merged 4 commits into from
Oct 21, 2019

Conversation

ashbhandare
Copy link
Contributor

The base MobileNetV2 model is from https://github.com/tensorflow/models/tree/master/research/slim/nets/mobilenet . Checkpoint file used: https://storage.googleapis.com/mobilenet_v2/checkpoints/mobilenet_v2_1.4_224.tgz

Benchmarked transfer learning on the Cats V/s Dogs dataset at:
https://www.microsoft.com/en-us/download/details.aspx?id=54765

Trained last layer for 10 epochs with 0.0001f learning rate with batch size 32.
Final accuracy on eval set:
Micro-accuracy: 0.980959936533122,macro-accuracy = 0.980874311779911
Comparable Tensorflow acuracy for same task:
https://www.tensorflow.org/tutorials/images/transfer_learning#train_the_model

@ashbhandare ashbhandare requested a review from a team as a code owner October 18, 2019 21:31
@@ -1249,7 +1249,7 @@ public void TensorFlowImageClassification()
var pipeline = mlContext.Transforms.LoadImages("Image", fullImagesetFolderPath, false, "ImagePath") // false indicates we want the image as a VBuffer<byte>
.Append(mlContext.Model.ImageClassification(
"Image", "Label",
// Just by changing/selecting InceptionV3 here instead of
// Just by changing/selecting InceptionV3/MobilenetV2 here instead of
Copy link
Member

@eerhardt eerhardt Oct 18, 2019

Choose a reason for hiding this comment

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

Do you want to add a test for the new functionality? The CI isn't executing any of your new code. #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added unit test.


In reply to: 336686355 [](ancestors = 336686355)

@codecov
Copy link

codecov bot commented Oct 21, 2019

Codecov Report

Merging #4351 into master will increase coverage by <.01%.
The diff coverage is 97.43%.

@@            Coverage Diff             @@
##           master    #4351      +/-   ##
==========================================
+ Coverage   74.59%    74.6%   +<.01%     
==========================================
  Files         881      882       +1     
  Lines      154815   154848      +33     
  Branches    16910    16913       +3     
==========================================
+ Hits       115486   115524      +38     
+ Misses      34578    34574       -4     
+ Partials     4751     4750       -1
Flag Coverage Δ
#Debug 74.6% <97.43%> (ø) ⬆️
#production 70.18% <96.55%> (+0.01%) ⬆️
#test 89.54% <100%> (ø) ⬆️
Impacted Files Coverage Δ
...c/Microsoft.ML.Dnn/ImageClassificationTransform.cs 87.81% <100%> (+0.39%) ⬆️
...cenariosWithDirectInstantiation/TensorflowTests.cs 90.47% <100%> (ø) ⬆️
...tFramework/Attributes/TensorflowTheoryAttribute.cs 100% <100%> (ø)
src/Microsoft.ML.Dnn/DnnCatalog.cs 79.51% <88.88%> (+0.85%) ⬆️
....ML.AutoML/PipelineSuggesters/PipelineSuggester.cs 79.83% <0%> (-3.37%) ⬇️
...rosoft.ML.AutoML/ColumnInference/TextFileSample.cs 59.6% <0%> (-2.65%) ⬇️
src/Microsoft.ML.Transforms/Text/LdaTransform.cs 84.6% <0%> (+0.15%) ⬆️
...ML.Transforms/Text/StopWordsRemovingTransformer.cs 86.26% <0%> (+0.15%) ⬆️
... and 2 more

Copy link
Member

@codemzs codemzs left a comment

Choose a reason for hiding this comment

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

🕐

Copy link
Member

@codemzs codemzs left a comment

Choose a reason for hiding this comment

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

:shipit:

@ashbhandare ashbhandare merged commit db001f5 into dotnet:master Oct 21, 2019
@ashbhandare ashbhandare deleted the Mobilenet_v2 branch October 21, 2019 22:13
frank-dong-ms-zz pushed a commit to frank-dong-ms-zz/machinelearning that referenced this pull request Nov 4, 2019
dotnet#4351)

* add Mobilenet_V2 architecture support and sample

* Separated try catch fix in different issue, added model download location

* removed redundant sample, changed comment message to add MobilenetV2

* added test for MobileNetV2, reusing test with Theory
@ghost ghost locked as resolved and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants