未验证 提交 019936a1 编写于 作者: D dyning 提交者: GitHub

Merge pull request #13 from WuHaobo/master

resolve code 
*.pyc
*.sw*
*log*
/dataset
*/workerlog*
dataset/
checkpoints/
output/
pretrained/
*.ipynb*
build/
mode: 'train'
architecture: "AlexNet"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......@@ -48,8 +48,6 @@ TRAIN:
order: ''
- ToCHWImage:
VALID:
batch_size: 64
num_workers: 4
......@@ -72,4 +70,3 @@ VALID:
order: ''
- ToCHWImage:
mode: 'train'
architecture: 'DPN107'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'DPN131'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'DPN68'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'DPN92'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'DPN98'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "DarkNet53"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'DenseNet121'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'DenseNet161'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'DenseNet169'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'DenseNet201'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'DenseNet264'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'HRNet_W18_C'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'HRNet_W30_C'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'HRNet_W32_C'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'HRNet_W40_C'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'HRNet_W44_C'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'HRNet_W48_C'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'HRNet_W64_C'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "GoogLeNet"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'InceptionV4'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV1"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV1_x0_25"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV1_x0_5"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV1_x0_75"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV2"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV2_x0_25"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV2_x0_5"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV2_x0_75"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV2_x1_5"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV2_x2_0"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV3_large_x0_35"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV3_large_x0_5"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV3_large_x0_75"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV3_large_x1_0"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV3_large_x1_25"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV3_small_x0_35"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV3_small_x0_5"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV3_small_x0_75"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV3_small_x1_0"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "MobileNetV3_small_x1_25"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'Res2Net101_vd_26w_4s'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'Res2Net200_vd_26w_4s'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'Res2Net50_14w_8s'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'Res2Net50_26w_4s'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'Res2Net50_vd_26w_4s'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNeXt101_32x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNeXt101_64x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNeXt101_vd_32x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNeXt101_vd_64x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNeXt152_32x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNeXt152_64x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNeXt152_vd_32x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNeXt152_vd_64x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNeXt50_32x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "ResNeXt50_64x4d"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "ResNeXt50_vd_32x4d"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNeXt50_vd_64x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet101'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet101_vd'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet152'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet152_vd'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet18'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet18_vd'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet200_vd'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet34'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet34_vd'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet50'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet50_vc'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'ResNet50_vd'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "ResNet_ACNet"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'SENet154_vd'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'SE_ResNeXt101_32x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'SE_ResNeXt50_32x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'SE_ResNeXt50_vd_32x4d'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'SE_ResNet18_vd'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'SE_ResNet34_vd'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: 'SE_ResNet50_vd'
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "ShuffleNetV2"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "ShuffleNetV2_swish"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "ShuffleNetV2_x0_25"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "ShuffleNetV2_x0_33"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "ShuffleNetV2_x0_5"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "ShuffleNetV2_x1_5"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "ShuffleNetV2_x2_0"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "SqueezeNet1_0"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "SqueezeNet1_1"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "VGG11"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "VGG13"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "VGG16"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
mode: 'train'
architecture: "VGG19"
pretrained_model: ""
model_save_dir: "./checkpoints/"
model_save_dir: "./output/"
classes_num: 1000
total_images: 1281167
save_interval: 1
......
......@@ -6,7 +6,6 @@ total_images: 1281167
topk: 5
image_shape: [3, 224, 224]
VALID:
batch_size: 16
num_workers: 4
......
set -e
if [ "x${IMAGENET_USERNAME}" == x -o "x${IMAGENET_ACCESS_KEY}" == x ];then
echo "Please create an account on image-net.org."
echo "It will provide you a pair of username and accesskey to download imagenet data."
read -p "Username: " IMAGENET_USERNAME
read -p "Accesskey: " IMAGENET_ACCESS_KEY
fi
root_url=http://www.image-net.org/challenges/LSVRC/2012/nnoupb
valid_tar=ILSVRC2012_img_val.tar
train_tar=ILSVRC2012_img_train.tar
train_folder=train/
valid_folder=val/
echo "Download imagenet training data..."
mkdir -p ${train_folder}
wget -nd -c ${root_url}/${train_tar}
tar xf ${train_tar} -C ${train_folder}
cd ${train_folder}
for x in `ls *.tar`
do
filename=`basename $x .tar`
mkdir -p $filename
tar -xf $x -C $filename
rm -rf $x
done
cd -
echo "Download imagenet validation data..."
mkdir -p ${valid_folder}
wget -nd -c ${root_url}/${valid_tar}
tar xf ${valid_tar} -C ${valid_folder}
echo "Download imagenet label file: val_list.txt & train_list.txt"
label_file=ImageNet_label.tgz
label_url=http://paddle-imagenet-models.bj.bcebos.com/${label_file}
wget -nd -c ${label_url}
tar zxf ${label_file}
......@@ -22,8 +22,8 @@ PaddleClas 提供模型训练与评估脚本:tools/train.py和tools/eval.py
python -m paddle.distributed.launch \
--selected_gpus="0,1,2,3" \
--log_dir=log_ResNet50 \
train.py \
-c ./configs/ResNet/ResNet50.yaml \
tools/train.py \
-c ./configs/ResNet/ResNet50.yaml
```
- 输出日志示例如下:
......@@ -38,9 +38,9 @@ epoch:0 train step:13 loss:7.9561 top1:0.0156 top5:0.1094 lr:0
python -m paddle.distributed.launch \
--selected_gpus="0,1,2,3" \
--log_dir=log_ResNet50_vd \
train.py \
tools/train.py \
-c ./configs/ResNet/ResNet50_vd.yaml \
-o use_mix=1 \
-o use_mix=1
```
......@@ -56,7 +56,7 @@ epoch:0 train step:522 loss:1.6330 lr:0.100000 elapse:0.210
### 2.2 模型评估
```bash
python eval.py \
python tools/eval.py \
-c ./configs/eval.yaml \
-o architecture="ResNet50_vd" \
-o pretrained_model=path_to_pretrained_models
......@@ -76,7 +76,7 @@ python tools/export_model.py \
```
之后,通过预测引擎进行推理
```bash
python tools/predict.py \
python tools/infer/predict.py \
-m model文件路径 \
-p params文件路径 \
-i 图片路径 \
......
#copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
#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.
import os
import logging
import random
DEBUG = logging.DEBUG #10
INFO = logging.INFO #20
WARN = logging.WARN #30
ERROR = logging.ERROR #40
class Logger(object):
"""
Logger
"""
def __init__(self, level=DEBUG):
self.init(level)
def init(self, level=DEBUG):
"""
init
"""
self._logger = logging.getLogger()
self._logger.setLevel(level)
def info(self, fmt, *args):
"""info"""
self._logger.info(fmt, *args)
def warning(self, fmt, *args):
"""warning"""
self._logger.warning(fmt, *args)
def error(self, fmt, *args):
"""error"""
self._logger.error(fmt, *args)
_logger = Logger()
def init(level=DEBUG):
"""init for external"""
_logger.init(level)
def info(fmt, *args):
"""info"""
_logger.info(fmt, *args)
def warning(fmt, *args):
"""warn"""
_logger.warning(fmt, *args)
def error(fmt, *args):
"""error"""
_logger.error(fmt, *args)
......@@ -16,9 +16,10 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import errno
import os
import tempfile
import shutil
import tempfile
import paddle
import paddle.fluid as fluid
......@@ -30,10 +31,18 @@ __all__ = ['init_model', 'save_model']
def _mkdir_if_not_exist(path):
"""
mkdir if not exists
mkdir if not exists, ignore the exception when multiprocess mkdir together
"""
if not os.path.exists(os.path.join(path)):
os.makedirs(os.path.join(path))
if not os.path.exists(path):
try:
os.makedirs(path)
except OSError as e:
if e.errno == errno.EEXIST and os.path.isdir(path):
logger.warning(
'be happy if some process has already created {}'.format(
path))
else:
raise OSError('Failed to mkdir {}'.format(path))
def _load_state(path):
......
#!/usr/bin/env bash
export PYTHONPATH=$(dirname "$PWD"):$PWD:$PYTHONPATH
#python download.py -a ResNet181 -p ./pretrained/ -d 1
#python download.py -a ResNet18 -p ./pretrained/ -d 1
#python download.py -a ResNet34 -p ./pretrained/ -d 0
#python -m paddle.distributed.launch --selected_gpus="0,1,2,3" --log_dir=mylog tools/train.py
#python -m paddle.distributed.launch --selected_gpus="0,1,2,3" --log_dir=mylog ./eval.py
export PYTHONPATH=$PWD:$PYTHONPATH
python -m paddle.distributed.launch \
--selected_gpus="0,1,2,3" \
--log_dir=mylog \
--log_dir=log_ResNet50 \
tools/train.py \
-c configs/ResNet/ResNet50_vd.yaml \
-o use_mix=0 \
-o TRAIN.batch_size=128 \
-o TRAIN.transforms.3.NormalizeImage.mean.2=0.4
-c ./configs/ResNet/ResNet50.yaml
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册