-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Moco v2 #2757
Moco v2 #2757
Conversation
Thanks for your contribution! |
moco-v2-clas复现精度67.6,和原paper精度一致 |
@TingquanGao 请review代码 |
代码提交前用pre-commit了么?主要是编码风格。 |
代码提交前pre-commit全部pass |
@TingquanGao 已经按照上述建议完成项目修改,请再次review |
验收通过: pretrain: fine-tune: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个文件好像不需要修改?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,已恢复原来更改 8cf3bc2
@@ -12,6 +12,7 @@ | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
|
|||
from paddle.vision.transforms import ToTensor, Normalize, RandomHorizontalFlip, RandomResizedCrop, Transpose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transpose 这个好像并没有用到?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已改,ea714d2
|
||
# model architecture | ||
Arch: | ||
name: moco_v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样吧:
moco_v2 -> MoCoV2
return model | ||
|
||
|
||
def moco_v2(backbone, neck, head, pretrained=False, use_ssld=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moco_v2 -> MoCoV2
layer._use_global_stats = True | ||
|
||
|
||
def moco_v1(backbone, neck, head, pretrained=False, use_ssld=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moco_v1 -> MoCoV1
param.trainable = False | ||
|
||
|
||
def moco_clas(backbone, head, pretrained=False, use_ssld=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moco_clas -> MoCo_finetune
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已改,b2fe78a
class GaussianBlur(object): | ||
"""Gaussian blur augmentation in SimCLR https://arxiv.org/abs/2002.05709""" | ||
|
||
def __init__(self, sigma=[.1, 2.], _PIL=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的 _PIL=False 参数,改成 backend="cv2" 吧,和其他预处理算子用法一致。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已改,ea714d2
x = x.filter(ImageFilter.GaussianBlur(radius=sigma)) | ||
return x | ||
else: | ||
import cv2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cv2不需要再import了,上面应该import过
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已改,ea714d2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一点小问题,麻烦再改一下吧。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thank you |
添加moco_v2, moco_clas模型