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

add efficientnetv2 #4910

Closed
wants to merge 1 commit into from
Closed

add efficientnetv2 #4910

wants to merge 1 commit into from

Conversation

xiaohu2015
Copy link
Contributor

I want to add efficientnetv2. #2707

@facebook-github-bot
Copy link

facebook-github-bot commented Nov 11, 2021

💊 CI failures summary and remediations

As of commit ad5a240 (more details on the Dr. CI page):


  • 2/2 failures introduced in this PR

🕵️ 1 new failure recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build binary_libtorchvision_ops_android (1/1)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradl...ibraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.502+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match org.apache.httpcomponents:httpcore:4.4.10 configuration runtime from candidates [org.apache.httpcomponents:httpcore:4.4.10 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match androidx.databinding:databinding-common:4.1.2 configuration runtime from candidates [androidx.databinding:databinding-common:4.1.2 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match com.android.databinding:baseLibrary:4.1.2 configuration runtime from candidates [com.android.databinding:baseLibrary:4.1.2 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match org.antlr:antlr4:4.5.3 configuration runtime from candidates [org.antlr:antlr4:4.5.3 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match commons-io:commons-io:2.4 configuration runtime from candidates [commons-io:commons-io:2.4 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match com.googlecode.juniversalchardet:juniversalchardet:1.0.3 configuration runtime from candidates [com.googlecode.juniversalchardet:juniversalchardet:1.0.3 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match com.google.code.gson:gson:2.8.5 configuration runtime from candidates [com.google.code.gson:gson:2.8.5 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match org.glassfish.jaxb:jaxb-runtime:2.3.1 configuration runtime from candidates [org.glassfish.jaxb:jaxb-runtime:2.3.1 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match net.sf.proguard:proguard-base:6.0.3 configuration runtime from candidates [net.sf.proguard:proguard-base:6.0.3 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match com.google.auto.value:auto-value-annotations:1.6.2 configuration runtime from candidates [com.google.auto.value:auto-value-annotations:1.6.2 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match com.google.errorprone:error_prone_annotations:2.3.2 configuration runtime from candidates [com.google.errorprone:error_prone_annotations:2.3.2 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match org.jdom:jdom2:2.0.6 configuration runtime from candidates [org.jdom:jdom2:2.0.6 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match org.json:json:20180813 configuration runtime from candidates [org.json:json:20180813 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match org.checkerframework:checker-qual:2.8.1 configuration runtime from candidates [org.checkerframework:checker-qual:2.8.1 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match com.squareup.okhttp3:okhttp:3.14.4 configuration runtime from candidates [com.squareup.okhttp3:okhttp:3.14.4 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match com.squareup.okio:okio:1.17.5 configuration runtime from candidates [com.squareup.okio:okio:1.17.5 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30 configuration runtime from candidates [org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match org.jetbrains:annotations:13.0 configuration runtime from candidates [org.jetbrains:annotations:13.0 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match org.apache.commons:commons-compress:1.12 configuration runtime from candidates [org.apache.commons:commons-compress:1.12 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match org.jetbrains.trove4j:trove4j:20160824 configuration runtime from candidates [org.jetbrains.trove4j:trove4j:20160824 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
2021-11-11T11:39:42.503+0000 [DEBUG] [org.gradle.internal.component.model.LoggingAttributeMatchingExplanationBuilder] Selected match net.sf.kxml:kxml2:2.3.0 configuration runtime from candidates [net.sf.kxml:kxml2:2.3.0 configuration runtime] for {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.version=11, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}

1 failure not recognized by patterns:

Job Step Action
CircleCI python_lint pre-commit run --all-files 🔁 rerun

This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@xiaohu2015
Copy link
Contributor Author

I implement EfficientNetV2 just like the style of EfficientNetV1 in torchvision models. I also converted the timm pretrained weights, but I found the acc dropped a lot (for example, EfficientNetV2-S is about 82.9 rather 83.9) because of the different padding for 3x3 conv of stride2.

@datumbox
Copy link
Contributor

datumbox commented Nov 11, 2021

@xiaohu2015 First of all let me confirm that the EfficientNetV2 is within the list of models we would like to include on TorchVision. So the contribution is definitely useful and thank you for it. Moreover your code is of high quality and follows the conventions/style of TorchVision.

Unfortunately accepting model contributions from the community has been challenging in the past, primarily due to training issues (see our contribution guide). You can read more about this at #2707 (comment). The TLDR for it is that we don't accept contributions without trained weights which fully reproduce the accuracy of the paper. On the one hand, getting the weights is quite a lot to ask from open-source contributors because training is quite expensive. On the other, a contribution without weights means that an internal maintainer needs to do a significant amount of work to reproduce the paper and that might not be possible due to different priorities. Taking weights from elsewhere is something done in the past but we usually try to avoid for various reasons (lack of reproducibility, minor implementation differences can lead to large accuracy gaps as the ones you report above, adds little value to the community etc).

This is why especially for very large features such as this, it's imperative that we discuss the details prior starting the work. Here are a few things we want to typically clarify:

  1. Confirm that the feature is needed
  2. Find one maintainer from our team with the capacity to review/verify/guide the effort
  3. Discuss the details of the implementation with the maintainer and agree on the direction

Doing the above help us identify the risks, plan features based on our capacity and ensure we don't throwaway work. I've been an Open-source contributor myself in the past and there is nothing worst than spending couple of weeks to write a feature only to be rejected or to remain unmerged for months due to lack of priority... This is the reason we want to clarify all the above prior starting writing the PR.

Concerning the contents of this PR, here are a few concerns:

  1. Though I see you try to inherit components from EfficientNet, there is a lot of code duplication. Ideally we would like to extend V1 in a BC way to accommodate most of the changes of V2. Where we plan to extend V1 and where we introduce a new class for V2 is non-trivial and requires investigation.
  2. The PR needs to be accompanied with pre-trained weights, trained from scratch using our reference scripts and fully reproduce the performances of the paper. That is only possible if you have access on hardware that will allow you to train the model.

I think to make this PR mergeable will require a lot of work, so I would like to understand the situation on your side. :)

@xiaohu2015
Copy link
Contributor Author

@datumbox thanks, I am looking foward to your implemention. I will close this pr.

@xiaohu2015 xiaohu2015 closed this Nov 11, 2021
@datumbox
Copy link
Contributor

@xiaohu2015 Your PRs are definitely welcome. If you have any other features you would like to work on let's chat about it on their linked issues to map out the details. :)

@xiaohu2015
Copy link
Contributor Author

@datumbox Ok, thanks again.

@bratao
Copy link

bratao commented Dec 11, 2021

Thank you @xiaohu2015 for this great implementation!

@xiaohu2015
Copy link
Contributor Author

@bratao you can get the original implementation here: https://github.com/xiaohu2015/nncls/blob/main/models/efficientnetv2.py

@datumbox
Copy link
Contributor

@xiaohu2015 We should consider adapting the existing efficientnet.py implementation of TorchVision to support both V1 and V2 and port it in. This can wait for after your other PR #4961 about FCOS is merged. :)

@jdsgomes jdsgomes mentioned this pull request Jan 14, 2022
@datumbox datumbox mentioned this pull request Feb 11, 2022
24 tasks
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.

4 participants