commit
a86e32f2fc
7 changed files with 49 additions and 92 deletions
@ -1,15 +0,0 @@ |
||||
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. |
||||
# |
||||
# 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 |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
|
||||
from .detector import * |
@ -1,54 +0,0 @@ |
||||
import sys |
||||
|
||||
sys.path.append("/ssd2/pengjuncai/PaddleRS") |
||||
|
||||
import paddlers as pdrs |
||||
from paddlers import transforms as T |
||||
|
||||
train_transforms = T.Compose([ |
||||
T.MixupImage(mixup_epoch=-1), T.RandomDistort(), |
||||
T.RandomExpand(im_padding_value=[123.675, 116.28, 103.53]), T.RandomCrop(), |
||||
T.RandomHorizontalFlip(), T.BatchRandomResize( |
||||
target_sizes=[320, 352, 384, 416, 448, 480, 512, 544, 576, 608], |
||||
interp='RANDOM'), T.Normalize( |
||||
mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) |
||||
]) |
||||
|
||||
eval_transforms = T.Compose([ |
||||
T.Resize( |
||||
target_size=608, interp='CUBIC'), T.Normalize( |
||||
mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) |
||||
]) |
||||
|
||||
|
||||
train_dataset = pdrs.datasets.VOCDetection( |
||||
data_dir='insect_det', |
||||
file_list='insect_det/train_list.txt', |
||||
label_list='insect_det/labels.txt', |
||||
transforms=train_transforms, |
||||
shuffle=True) |
||||
|
||||
eval_dataset = pdrs.datasets.VOCDetection( |
||||
data_dir='insect_det', |
||||
file_list='insect_det/val_list.txt', |
||||
label_list='insect_det/labels.txt', |
||||
transforms=eval_transforms, |
||||
shuffle=False) |
||||
|
||||
|
||||
num_classes = len(train_dataset.labels) |
||||
model = pdrs.tasks.det.PPYOLO(num_classes=num_classes, backbone='ResNet50_vd_dcn') |
||||
|
||||
model.train( |
||||
num_epochs=200, |
||||
train_dataset=train_dataset, |
||||
train_batch_size=8, |
||||
eval_dataset=eval_dataset, |
||||
pretrain_weights='COCO', |
||||
learning_rate=0.005 / 12, |
||||
warmup_steps=500, |
||||
warmup_start_lr=0.0, |
||||
save_interval_epochs=5, |
||||
lr_decay_epochs=[85, 135], |
||||
save_dir='output/ppyolo_r50vd_dcn', |
||||
use_vdl=True) |
Loading…
Reference in new issue