未验证 提交 973cdef1 编写于 作者: C cuicheng01 提交者: GitHub

Merge pull request #2154 from cuicheng01/fix_pelee_convnext

Fix pelee convnext
# MIT License # copyright (c) 2022 PaddlePaddle Authors. All Rights Reserve.
# #
# Copyright (c) Meta Platforms, Inc. and affiliates. # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # http://www.apache.org/licenses/LICENSE-2.0
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# #
# The above copyright notice and this permission notice shall be included in all # Unless required by applicable law or agreed to in writing, software
# copies or substantial portions of the Software. # distributed under the License is distributed on an "AS IS" BASIS,
# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # See the License for the specific language governing permissions and
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # limitations under the License.
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# #
# Code was heavily based on https://github.com/facebookresearch/ConvNeXt # Code was heavily based on https://github.com/facebookresearch/ConvNeXt
...@@ -138,7 +130,7 @@ class Block(nn.Layer): ...@@ -138,7 +130,7 @@ class Block(nn.Layer):
class ConvNeXt(nn.Layer): class ConvNeXt(nn.Layer):
r""" ConvNeXt r""" ConvNeXt
A PyTorch impl of : `A ConvNet for the 2020s` - A PaddlePaddle impl of : `A ConvNet for the 2020s` -
https://arxiv.org/pdf/2201.03545.pdf https://arxiv.org/pdf/2201.03545.pdf
Args: Args:
......
# copyright (c) 2022 PaddlePaddle Authors. All Rights Reserve. # copyright (c) 2022 PaddlePaddle Authors. All Rights Reserve.
# #
# MIT License # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # http://www.apache.org/licenses/LICENSE-2.0
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# #
# The above copyright notice and this permission notice shall be included in all # Unless required by applicable law or agreed to in writing, software
# copies or substantial portions of the Software. # distributed under the License is distributed on an "AS IS" BASIS,
# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # See the License for the specific language governing permissions and
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # limitations under the License.
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# #
# Code was heavily based on https://github.com/Robert-JunWang/PeleeNet # Code was heavily based on https://github.com/Robert-JunWang/PeleeNet
# reference: https://arxiv.org/pdf/1804.06882.pdf # reference: https://arxiv.org/pdf/1804.06882.pdf
...@@ -33,7 +25,7 @@ from paddle.nn.initializer import Normal, Constant ...@@ -33,7 +25,7 @@ from paddle.nn.initializer import Normal, Constant
from ppcls.utils.save_load import load_dygraph_pretrain, load_dygraph_pretrain_from_url from ppcls.utils.save_load import load_dygraph_pretrain, load_dygraph_pretrain_from_url
MODEL_URLS = { MODEL_URLS = {
"peleenet": "" # TODO "PeleeNet": "" # TODO
} }
__all__ = MODEL_URLS.keys() __all__ = MODEL_URLS.keys()
...@@ -235,5 +227,5 @@ def _load_pretrained(pretrained, model, model_url, use_ssld): ...@@ -235,5 +227,5 @@ def _load_pretrained(pretrained, model, model_url, use_ssld):
def PeleeNet(pretrained=False, use_ssld=False, **kwargs): def PeleeNet(pretrained=False, use_ssld=False, **kwargs):
model = PeleeNetDY(**kwargs) model = PeleeNetDY(**kwargs)
_load_pretrained(pretrained, model, MODEL_URLS["peleenet"], use_ssld) _load_pretrained(pretrained, model, MODEL_URLS["PeleeNet"], use_ssld)
return model return model
...@@ -55,6 +55,8 @@ DataLoader: ...@@ -55,6 +55,8 @@ DataLoader:
channel_first: False channel_first: False
- RandCropImage: - RandCropImage:
size: 224 size: 224
interpolation: bilinear
backend: pil
- RandFlipImage: - RandFlipImage:
flip_code: 1 flip_code: 1
- NormalizeImage: - NormalizeImage:
...@@ -83,6 +85,8 @@ DataLoader: ...@@ -83,6 +85,8 @@ DataLoader:
channel_first: False channel_first: False
- ResizeImage: - ResizeImage:
resize_short: 256 resize_short: 256
interpolation: bilinear
backend: pil
- CropImage: - CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
...@@ -108,6 +112,8 @@ Infer: ...@@ -108,6 +112,8 @@ Infer:
channel_first: False channel_first: False
- ResizeImage: - ResizeImage:
resize_short: 256 resize_short: 256
interpolation: bilinear
backend: pil
- CropImage: - CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册