Merge pull request #6 from Bobholamovic/optimize_code

[Refactor] Optimize code
own
cc 2 years ago committed by GitHub
commit 1c95ab980e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      README.md
  2. 2
      docs/README.md
  3. 6
      docs/apis/model_zoo.md
  4. 2
      paddlers/datasets/voc.py
  5. 4
      paddlers/deploy/predictor.py
  6. 2
      paddlers/rs_models/__init__.py
  7. 0
      paddlers/rs_models/cd/__init__.py
  8. 0
      paddlers/rs_models/cd/backbones/__init__.py
  9. 0
      paddlers/rs_models/cd/backbones/resnet.py
  10. 0
      paddlers/rs_models/cd/bit.py
  11. 0
      paddlers/rs_models/cd/cdnet.py
  12. 2
      paddlers/rs_models/cd/changestar.py
  13. 0
      paddlers/rs_models/cd/dsamnet.py
  14. 0
      paddlers/rs_models/cd/dsifn.py
  15. 0
      paddlers/rs_models/cd/fc_ef.py
  16. 0
      paddlers/rs_models/cd/fc_siam_conc.py
  17. 0
      paddlers/rs_models/cd/fc_siam_diff.py
  18. 0
      paddlers/rs_models/cd/layers/__init__.py
  19. 0
      paddlers/rs_models/cd/layers/attention.py
  20. 0
      paddlers/rs_models/cd/layers/blocks.py
  21. 2
      paddlers/rs_models/cd/param_init.py
  22. 0
      paddlers/rs_models/cd/snunet.py
  23. 0
      paddlers/rs_models/cd/stanet.py
  24. 0
      paddlers/rs_models/clas/__init__.py
  25. 0
      paddlers/rs_models/clas/condensenet_v2.py
  26. 0
      paddlers/rs_models/det/__init__.py
  27. 0
      paddlers/rs_models/res/__init__.py
  28. 0
      paddlers/rs_models/res/generators/__init__.py
  29. 0
      paddlers/rs_models/res/generators/builder.py
  30. 0
      paddlers/rs_models/res/generators/rcan.py
  31. 0
      paddlers/rs_models/res/rcan_model.py
  32. 0
      paddlers/rs_models/seg/__init__.py
  33. 0
      paddlers/rs_models/seg/farseg.py
  34. 0
      paddlers/rs_models/seg/layers/__init__.py
  35. 0
      paddlers/rs_models/seg/layers/layers_lib.py
  36. 0
      paddlers/rs_models/seg/layers/param_init.py
  37. 10
      paddlers/tasks/__init__.py
  38. 2
      paddlers/tasks/base.py
  39. 6
      paddlers/tasks/change_detector.py
  40. 2
      paddlers/tasks/classifier.py
  41. 14
      paddlers/tasks/load_model.py
  42. 2
      paddlers/tasks/object_detector.py
  43. 4
      paddlers/tasks/segmenter.py
  44. 2
      paddlers/tasks/utils/infer_nets.py
  45. 2
      paddlers/transforms/operators.py
  46. 20
      tests/rs_models/test_cd_models.py
  47. 2
      tests/rs_models/test_seg_models.py
  48. 5
      tests/transforms/test_operators.py
  49. 2
      tutorials/train/change_detection/bit.py
  50. 2
      tutorials/train/change_detection/cdnet.py
  51. 2
      tutorials/train/change_detection/dsamnet.py
  52. 2
      tutorials/train/change_detection/dsifn.py
  53. 2
      tutorials/train/change_detection/fc_ef.py
  54. 2
      tutorials/train/change_detection/fc_siam_conc.py
  55. 2
      tutorials/train/change_detection/fc_siam_diff.py
  56. 2
      tutorials/train/change_detection/snunet.py
  57. 2
      tutorials/train/change_detection/stanet.py
  58. 2
      tutorials/train/classification/condensenetv2_b_rs_mul.py
  59. 2
      tutorials/train/classification/hrnet.py
  60. 3
      tutorials/train/classification/mobilenetv3.py
  61. 2
      tutorials/train/classification/resnet50_vd.py
  62. 2
      tutorials/train/image_restoration/drn_train.py
  63. 2
      tutorials/train/image_restoration/esrgan_train.py
  64. 2
      tutorials/train/image_restoration/lesrcnn_train.py
  65. 2
      tutorials/train/object_detection/faster_rcnn.py
  66. 2
      tutorials/train/object_detection/ppyolo.py
  67. 2
      tutorials/train/object_detection/ppyolotiny.py
  68. 2
      tutorials/train/object_detection/ppyolov2.py
  69. 2
      tutorials/train/object_detection/yolov3.py
  70. 1
      tutorials/train/semantic_segmentation/data/.gitignore
  71. 2
      tutorials/train/semantic_segmentation/deeplabv3p.py
  72. 2
      tutorials/train/semantic_segmentation/unet.py

@ -159,7 +159,7 @@ PaddleRS是遥感科研院所、相关高校共同基于飞桨开发的遥感处
├── deploy # 部署相关的文档和脚本
├── docs # 整个项目文档及图片
├── paddlers
│ ├── custom_models # 自定义网络模型代码
│ ├── rs_models # 遥感专用网络模型代码
│ ├── datasets # 数据加载相关代码
│ ├── models # 套件网络模型代码
│ ├── tasks # 相关任务代码

@ -1,3 +1,3 @@
# 开发规范
请注意,paddlers/models/ppxxx系列除了修改import路径和支持多通道模型外,不要增删改任何代码。
新增的模型需放在paddlers/models/下的seg、det、cls、cd目录下。
新增的模型需放在paddlers/models/下的seg、det、clas、cd目录下。

@ -2,7 +2,7 @@
PaddleRS的基础模型库来自[PaddleClas](https://github.com/PaddlePaddle/PaddleClas/blob/release/2.3/docs/zh_CN/algorithm_introduction/ImageNet_models.md)、[PaddleSeg](https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.4/docs/model_zoo_overview_cn.md)、[PaddleDetection](https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.3/README_cn.md#模型库)以及[PaddleGAN](https://github.com/PaddlePaddle/PaddleGAN/blob/develop/README_cn.md#模型库),可以通过相关的链接进行查看。而在此之外,PaddleRS也针对遥感任务添加了一些特有的模型库,可用于遥感图像语义分割、遥感变化检测等。
## 自定义模型库
## 遥感专用模型库
| 模型名称 | 用途 |
| --------------- | -------- |
@ -20,7 +20,7 @@ PaddleRS的基础模型库来自[PaddleClas](https://github.com/PaddlePaddle/Pad
## 如何导入
模型均位于`paddlers/models`和`paddlers/custom_models`中,对于套件中的模型可以通过如下方法进行使用
模型均位于`paddlers/models`和`paddlers/rs_models`中,对于套件中的模型可以通过如下方法进行使用
```python
from paddlers.models import xxxx
@ -29,5 +29,5 @@ from paddlers.models import xxxx
而PaddleRS所特有的模型可以通过如下方法调用
```python
from paddlers.custom_models import xxxx
from paddlers.rs_models import xxxx
```

@ -186,7 +186,7 @@ class VOCDetection(BaseDataset):
box_tag = pattern.findall(str(ET.tostringlist(obj)))
if len(box_tag) == 0:
logging.warning(
"There's no field '<bndbox>' in one of object, "
"There is no field '<bndbox>' in the object, "
"so this object will be ignored. xml file: {}".
format(xml_file))
continue

@ -157,7 +157,7 @@ class Predictor(object):
}
elif self._model.model_type == 'detector':
pass
elif self._model.model_type == 'changedetector':
elif self._model.model_type == 'change_detector':
preprocessed_samples = {
'image': preprocessed_samples[0],
'image2': preprocessed_samples[1],
@ -186,7 +186,7 @@ class Predictor(object):
'scores_map': s,
'label_names_map': n,
} for l, s, n in zip(class_ids, scores, label_names)]
elif self._model.model_type in ('segmenter', 'changedetector'):
elif self._model.model_type in ('segmenter', 'change_detector'):
label_map, score_map = self._model._postprocess(
net_outputs,
batch_origin_shape=ori_shape,

@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from . import cls, det, seg, gan, cd
from . import clas, det, seg, res, cd

@ -17,7 +17,7 @@ import paddle.nn as nn
import paddle.nn.functional as F
from paddlers.datasets.cd_dataset import MaskType
from paddlers.custom_models.seg import FarSeg
from paddlers.rs_models.seg import FarSeg
from .layers import Conv3x3, Identity

@ -67,7 +67,7 @@ class KaimingInitMixin:
Examples:
from paddlers.custom_models.cd.models.param_init import KaimingInitMixin
from paddlers.rs_models.cd.models.param_init import KaimingInitMixin
class CustomNet(nn.Layer, KaimingInitMixin):
def __init__(self, num_channels, num_classes):

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from .object_detector import *
from .segmenter import *
from .change_detector import *
from .classifier import *
import paddlers.tasks.object_detector as det
import paddlers.tasks.segmenter as seg
import paddlers.tasks.change_detector as cd
import paddlers.tasks.classifier as clas
import paddlers.tasks.image_restorer as res
from .load_model import load_model
from .image_restorer import *

@ -614,7 +614,7 @@ class BaseModel(metaclass=ModelMeta):
def _build_inference_net(self):
if self.model_type in ('classifier', 'detector'):
infer_net = self.net
elif self.model_type == 'changedetector':
elif self.model_type == 'change_detector':
infer_net = InferCDNet(self.net)
else:
infer_net = InferNet(self.net, self.model_type)

@ -25,7 +25,7 @@ import paddle.nn.functional as F
from paddle.static import InputSpec
import paddlers
import paddlers.custom_models.cd as cmcd
import paddlers.rs_models.cd as cmcd
import paddlers.utils.logging as logging
import paddlers.models.ppseg as paddleseg
from paddlers.transforms import Resize, decode_image
@ -49,9 +49,9 @@ class BaseChangeDetector(BaseModel):
self.init_params = locals()
if 'with_net' in self.init_params:
del self.init_params['with_net']
super(BaseChangeDetector, self).__init__('changedetector')
super(BaseChangeDetector, self).__init__('change_detector')
if model_name not in __all__:
raise Exception("ERROR: There's no model named {}.".format(
raise ValueError("ERROR: There is no model named {}.".format(
model_name))
self.model_name = model_name
self.num_classes = num_classes

@ -23,7 +23,7 @@ import paddle.nn.functional as F
from paddle.static import InputSpec
import paddlers.models.ppcls as paddleclas
import paddlers.custom_models.cls as cmcls
import paddlers.rs_models.clas as cmcls
import paddlers
from paddlers.utils import get_single_card_bs, DisablePrint
import paddlers.utils.logging as logging

@ -73,9 +73,11 @@ def load_model(model_dir, **params):
assert status == 'Infer', \
"Only exported models can be deployed for inference, but current model status is {}.".format(status)
if not hasattr(paddlers.tasks, model_info['Model']):
raise Exception("There is no {} attribute in paddlers.tasks.".format(
model_info['Model']))
model_type = model_info['_Attributes']['model_type']
mod = getattr(paddlers.tasks, model_type)
if not hasattr(mod, model_info['Model']):
raise Exception("There is no {} attribute in {}.".format(model_info[
'Model'], mod))
if 'model_name' in model_info['_init_params']:
del model_info['_init_params']['model_name']
@ -88,7 +90,7 @@ def load_model(model_dir, **params):
)
params = model_info.pop('raw_params', {})
params.update(model_info['_init_params'])
model = getattr(paddlers.tasks, model_info['Model'])(**params)
model = getattr(mod, model_info['Model'])(**params)
if with_net:
if status == 'Pruned' or osp.exists(
osp.join(model_dir, "prune.yml")):
@ -127,9 +129,9 @@ def load_model(model_dir, **params):
else:
net_state_dict = paddle.load(osp.join(model_dir, 'model'))
if model.model_type in [
'classifier', 'segmenter', 'changedetector'
'classifier', 'segmenter', 'change_detector'
]:
# When exporting a classifier, segmenter, or changedetector,
# When exporting a classifier, segmenter, or change_detector,
# InferNet (or InferCDNet) is defined to append softmax and argmax operators to the model,
# so the parameter names all start with 'net.'
new_net_state_dict = {}

@ -48,7 +48,7 @@ class BaseDetector(BaseModel):
del self.init_params['with_net']
super(BaseDetector, self).__init__('detector')
if not hasattr(ppdet.modeling, model_name):
raise Exception("ERROR: There's no model named {}.".format(
raise ValueError("ERROR: There is no model named {}.".format(
model_name))
self.model_name = model_name

@ -24,7 +24,7 @@ import paddle.nn.functional as F
from paddle.static import InputSpec
import paddlers.models.ppseg as paddleseg
import paddlers.custom_models.seg as cmseg
import paddlers.rs_models.seg as cmseg
import paddlers
from paddlers.utils import get_single_card_bs, DisablePrint
import paddlers.utils.logging as logging
@ -48,7 +48,7 @@ class BaseSegmenter(BaseModel):
super(BaseSegmenter, self).__init__('segmenter')
if not hasattr(paddleseg.models, model_name) and \
not hasattr(cmseg, model_name):
raise Exception("ERROR: There's no model named {}.".format(
raise ValueError("ERROR: There is no model named {}.".format(
model_name))
self.model_name = model_name
self.num_classes = num_classes

@ -46,7 +46,7 @@ class InferCDNet(paddle.nn.Layer):
def __init__(self, net):
super(InferCDNet, self).__init__()
self.net = net
self.postprocessor = PostProcessor('changedetector')
self.postprocessor = PostProcessor('change_detector')
def forward(self, x1, x2):
net_outputs = self.net(x1, x2)

@ -284,7 +284,7 @@ class DecodeImg(Transform):
raise ValueError(
"The height or width of the image is not same as the mask.")
if 'aux_masks' in sample:
sample['aux_masks_ori'] = copy.deepcopy(sample['aux_masks_ori'])
sample['aux_masks_ori'] = copy.deepcopy(sample['aux_masks'])
sample['aux_masks'] = list(
map(self.apply_mask, sample['aux_masks']))
# TODO: check the shape of auxiliary masks

@ -65,7 +65,7 @@ class TestCDModel(TestModel):
class TestBITModel(TestCDModel):
MODEL_CLASS = paddlers.custom_models.cd.BIT
MODEL_CLASS = paddlers.rs_models.cd.BIT
def set_specs(self):
base_spec = dict(in_channels=3, num_classes=2)
@ -80,7 +80,7 @@ class TestBITModel(TestCDModel):
class TestCDNetModel(TestCDModel):
MODEL_CLASS = paddlers.custom_models.cd.CDNet
MODEL_CLASS = paddlers.rs_models.cd.CDNet
EF_MODE = 'Concat'
def set_specs(self):
@ -92,7 +92,7 @@ class TestCDNetModel(TestCDModel):
class TestChangeStarModel(TestCDModel):
MODEL_CLASS = paddlers.custom_models.cd.ChangeStar
MODEL_CLASS = paddlers.rs_models.cd.ChangeStar
def set_specs(self):
self.specs = [
@ -112,7 +112,7 @@ class TestChangeStarModel(TestCDModel):
class TestDSAMNetModel(TestCDModel):
MODEL_CLASS = paddlers.custom_models.cd.DSAMNet
MODEL_CLASS = paddlers.rs_models.cd.DSAMNet
def set_specs(self):
base_spec = dict(in_channels=3, num_classes=2)
@ -134,7 +134,7 @@ class TestDSAMNetModel(TestCDModel):
class TestDSIFNModel(TestCDModel):
MODEL_CLASS = paddlers.custom_models.cd.DSIFN
MODEL_CLASS = paddlers.rs_models.cd.DSIFN
def set_specs(self):
self.specs = [
@ -153,7 +153,7 @@ class TestDSIFNModel(TestCDModel):
class TestFCEarlyFusionModel(TestCDModel):
MODEL_CLASS = paddlers.custom_models.cd.FCEarlyFusion
MODEL_CLASS = paddlers.rs_models.cd.FCEarlyFusion
EF_MODE = 'Concat'
def set_specs(self):
@ -166,7 +166,7 @@ class TestFCEarlyFusionModel(TestCDModel):
class TestFCSiamConcModel(TestCDModel):
MODEL_CLASS = paddlers.custom_models.cd.FCSiamConc
MODEL_CLASS = paddlers.rs_models.cd.FCSiamConc
def set_specs(self):
self.specs = [
@ -178,7 +178,7 @@ class TestFCSiamConcModel(TestCDModel):
class TestFCSiamDiffModel(TestCDModel):
MODEL_CLASS = paddlers.custom_models.cd.FCSiamDiff
MODEL_CLASS = paddlers.rs_models.cd.FCSiamDiff
def set_specs(self):
self.specs = [
@ -190,7 +190,7 @@ class TestFCSiamDiffModel(TestCDModel):
class TestSNUNetModel(TestCDModel):
MODEL_CLASS = paddlers.custom_models.cd.SNUNet
MODEL_CLASS = paddlers.rs_models.cd.SNUNet
def set_specs(self):
self.specs = [
@ -202,7 +202,7 @@ class TestSNUNetModel(TestCDModel):
class TestSTANetModel(TestCDModel):
MODEL_CLASS = paddlers.custom_models.cd.STANet
MODEL_CLASS = paddlers.rs_models.cd.STANet
def set_specs(self):
base_spec = dict(in_channels=3, num_classes=2)

@ -48,7 +48,7 @@ class TestSegModel(TestModel):
class TestFarSegModel(TestSegModel):
MODEL_CLASS = paddlers.custom_models.seg.FarSeg
MODEL_CLASS = paddlers.rs_models.seg.FarSeg
def set_specs(self):
self.specs = [

@ -23,7 +23,7 @@ from data import build_input_from_file
__all__ = ['TestTransform', 'TestCompose', 'TestArrange']
WHITE_LIST = []
WHITE_LIST = ['ReloadMask']
def _add_op_tests(cls):
@ -37,6 +37,9 @@ def _add_op_tests(cls):
T.operators.Transform):
if op_class is T.DecodeImg or op_class in WHITE_LIST or op_name in WHITE_LIST:
continue
if issubclass(op_class, T.Compose) or issubclass(
op_class, T.operators.Arrange):
continue
attr_name = 'test_' + op_name
if hasattr(cls, attr_name):
continue

@ -74,7 +74,7 @@ eval_dataset = pdrs.datasets.CDDataset(
# 使用默认参数构建BIT模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py
model = pdrs.tasks.BIT()
model = pdrs.tasks.cd.BIT()
# 执行模型训练
model.train(

@ -74,7 +74,7 @@ eval_dataset = pdrs.datasets.CDDataset(
# 使用默认参数构建CDNet模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py
model = pdrs.tasks.CDNet()
model = pdrs.tasks.cd.CDNet()
# 执行模型训练
model.train(

@ -74,7 +74,7 @@ eval_dataset = pdrs.datasets.CDDataset(
# 使用默认参数构建DSAMNet模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py
model = pdrs.tasks.DSAMNet()
model = pdrs.tasks.cd.DSAMNet()
# 执行模型训练
model.train(

@ -74,7 +74,7 @@ eval_dataset = pdrs.datasets.CDDataset(
# 使用默认参数构建DSIFN模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py
model = pdrs.tasks.DSIFN()
model = pdrs.tasks.cd.DSIFN()
# 执行模型训练
model.train(

@ -74,7 +74,7 @@ eval_dataset = pdrs.datasets.CDDataset(
# 使用默认参数构建FC-EF模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py
model = pdrs.tasks.FCEarlyFusion()
model = pdrs.tasks.cd.FCEarlyFusion()
# 执行模型训练
model.train(

@ -74,7 +74,7 @@ eval_dataset = pdrs.datasets.CDDataset(
# 使用默认参数构建FC-Siam-conc模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py
model = pdrs.tasks.FCSiamConc()
model = pdrs.tasks.cd.FCSiamConc()
# 执行模型训练
model.train(

@ -74,7 +74,7 @@ eval_dataset = pdrs.datasets.CDDataset(
# 使用默认参数构建FC-Siam-diff模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py
model = pdrs.tasks.FCSiamDiff()
model = pdrs.tasks.cd.FCSiamDiff()
# 执行模型训练
model.train(

@ -74,7 +74,7 @@ eval_dataset = pdrs.datasets.CDDataset(
# 使用默认参数构建SNUNet模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py
model = pdrs.tasks.SNUNet()
model = pdrs.tasks.cd.SNUNet()
# 执行模型训练
model.train(

@ -74,7 +74,7 @@ eval_dataset = pdrs.datasets.CDDataset(
# 使用默认参数构建STANet模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py
model = pdrs.tasks.STANet()
model = pdrs.tasks.cd.STANet()
# 执行模型训练
model.train(

@ -39,7 +39,7 @@ eval_dataset = pdrs.datasets.ClasDataset(
# 初始化模型
num_classes = len(train_dataset.labels)
model = pdrs.tasks.CondenseNetV2_b(in_channels=5, num_classes=num_classes)
model = pdrs.tasks.clas.CondenseNetV2_b(in_channels=5, num_classes=num_classes)
# 进行训练
model.train(

@ -70,7 +70,7 @@ eval_dataset = pdrs.datasets.ClasDataset(
# 使用默认参数构建HRNet模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/classifier.py
model = pdrs.tasks.HRNet_W18_C(num_classes=len(train_dataset.labels))
model = pdrs.tasks.clas.HRNet_W18_C(num_classes=len(train_dataset.labels))
# 执行模型训练
model.train(

@ -70,7 +70,8 @@ eval_dataset = pdrs.datasets.ClasDataset(
# 使用默认参数构建MobileNetV3模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/classifier.py
model = pdrs.tasks.MobileNetV3_small_x1_0(num_classes=len(train_dataset.labels))
model = pdrs.tasks.clas.MobileNetV3_small_x1_0(
num_classes=len(train_dataset.labels))
# 执行模型训练
model.train(

@ -70,7 +70,7 @@ eval_dataset = pdrs.datasets.ClasDataset(
# 使用默认参数构建ResNet50-vd模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/classifier.py
model = pdrs.tasks.ResNet50_vd(num_classes=len(train_dataset.labels))
model = pdrs.tasks.clas.ResNet50_vd(num_classes=len(train_dataset.labels))
# 执行模型训练
model.train(

@ -66,7 +66,7 @@ test_dataset = pdrs.datasets.SRdataset(
scale=scale)
# 初始化模型,可以对网络结构的参数进行调整
model = pdrs.tasks.DRNet(
model = pdrs.tasks.res.DRNet(
n_blocks=30, n_feats=16, n_colors=3, rgb_range=255, negval=0.2)
model.train(

@ -65,7 +65,7 @@ test_dataset = pdrs.datasets.SRdataset(
# 初始化模型,可以对网络结构的参数进行调整
# 若loss_type='gan' 使用感知损失、对抗损失和像素损失
# 若loss_type = 'pixel' 只使用像素损失
model = pdrs.tasks.ESRGANet(loss_type='pixel')
model = pdrs.tasks.res.ESRGANet(loss_type='pixel')
model.train(
total_iters=1000000,

@ -63,7 +63,7 @@ test_dataset = pdrs.datasets.SRdataset(
scale=scale)
# 初始化模型,可以对网络结构的参数进行调整
model = pdrs.tasks.LESRCNNet(scale=4, multi_scale=False, group=1)
model = pdrs.tasks.res.LESRCNNet(scale=4, multi_scale=False, group=1)
model.train(
total_iters=1000000,

@ -79,7 +79,7 @@ eval_dataset = pdrs.datasets.VOCDetection(
# 构建Faster R-CNN模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/object_detector.py
model = pdrs.tasks.FasterRCNN(num_classes=len(train_dataset.labels))
model = pdrs.tasks.det.FasterRCNN(num_classes=len(train_dataset.labels))
# 执行模型训练
model.train(

@ -80,7 +80,7 @@ eval_dataset = pdrs.datasets.VOCDetection(
# 构建PP-YOLO模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/object_detector.py
model = pdrs.tasks.PPYOLO(num_classes=len(train_dataset.labels))
model = pdrs.tasks.det.PPYOLO(num_classes=len(train_dataset.labels))
# 执行模型训练
model.train(

@ -80,7 +80,7 @@ eval_dataset = pdrs.datasets.VOCDetection(
# 构建PP-YOLO Tiny模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/object_detector.py
model = pdrs.tasks.PPYOLOTiny(num_classes=len(train_dataset.labels))
model = pdrs.tasks.det.PPYOLOTiny(num_classes=len(train_dataset.labels))
# 执行模型训练
model.train(

@ -80,7 +80,7 @@ eval_dataset = pdrs.datasets.VOCDetection(
# 构建PP-YOLOv2模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/object_detector.py
model = pdrs.tasks.PPYOLOv2(num_classes=len(train_dataset.labels))
model = pdrs.tasks.det.PPYOLOv2(num_classes=len(train_dataset.labels))
# 执行模型训练
model.train(

@ -80,7 +80,7 @@ eval_dataset = pdrs.datasets.VOCDetection(
# 构建YOLOv3模型,使用DarkNet53作为backbone
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/object_detector.py
model = pdrs.tasks.YOLOv3(
model = pdrs.tasks.det.YOLOv3(
num_classes=len(train_dataset.labels), backbone='DarkNet53')
# 执行模型训练

@ -1,4 +1,3 @@
*.zip
*.tar.gz
rsseg/
optic/

@ -72,7 +72,7 @@ eval_dataset = pdrs.datasets.SegDataset(
# 构建DeepLab V3+模型,使用ResNet-50作为backbone
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/segmenter.py
model = pdrs.tasks.DeepLabV3P(
model = pdrs.tasks.seg.DeepLabV3P(
input_channel=NUM_BANDS,
num_classes=len(train_dataset.labels),
backbone='ResNet50_vd')

@ -72,7 +72,7 @@ eval_dataset = pdrs.datasets.SegDataset(
# 构建UNet模型
# 目前已支持的模型请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/docs/apis/model_zoo.md
# 模型输入参数请参考:https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/segmenter.py
model = pdrs.tasks.UNet(
model = pdrs.tasks.seg.UNet(
input_channel=NUM_BANDS, num_classes=len(train_dataset.labels))
# 执行模型训练

Loading…
Cancel
Save