提交 a349f799 编写于 作者: F Flowingsun007

replace warning function >> flow.image.Resize() with new api

上级 637bb9cd
......@@ -92,11 +92,10 @@ def load_imagenet_for_training(args):
color_space=color_space)
label = flow.data.OFRecordRawDecoder(
ofrecord, "class/label", shape=(), dtype=flow.int32)
rsz = flow.image.Resize(image, resize_x=args.image_size, resize_y=args.image_size,
color_space=color_space)
rsz = flow.image.Resize(image, target_size=[args.image_size, args.image_size])
rng = flow.random.CoinFlip(batch_size=train_batch_size) # , seed=seed)
normal = flow.image.CropMirrorNormalize(rsz, mirror_blob=rng, color_space=color_space,
normal = flow.image.CropMirrorNormalize(rsz[0], mirror_blob=rng, color_space=color_space,
mean=args.rgb_mean, std=args.rgb_std, output_dtype=flow.float)
return label, normal
......@@ -115,10 +114,13 @@ def load_imagenet_for_validation(args):
ofrecord, "encoded", color_space=color_space)
label = flow.data.OFRecordRawDecoder(
ofrecord, "class/label", shape=(), dtype=flow.int32)
rsz = flow.image.Resize(
image, resize_shorter=args.resize_shorter, color_space=color_space)
image, resize_side="shorter",
keep_aspect_ratio=True,
target_size=args.resize_shorter)
normal = flow.image.CropMirrorNormalize(rsz, color_space=color_space,
normal = flow.image.CropMirrorNormalize(rsz[0], color_space=color_space,
crop_h=args.image_size, crop_w=args.image_size, crop_pos_y=0.5, crop_pos_x=0.5,
mean=args.rgb_mean, std=args.rgb_std, output_dtype=flow.float)
return label, normal
......
#!/bin/sh
#!/bin/bash
rm -rf core.*
rm -rf ./output/snapshots/*
......@@ -17,6 +17,29 @@ python3 of_cnn_train_val.py \
--model="resnet50"
# # training with mini-imagenet
# DATA_ROOT=data/mini-imagenet/ofrecord
# python3 of_cnn_train_val.py \
# --train_data_dir=$DATA_ROOT/train \
# --num_examples=50 \
# --train_data_part_num=1 \
# --val_data_dir=$DATA_ROOT/validation \
# --num_val_examples=50 \
# --val_data_part_num=1 \
# --num_nodes=1 \
# --gpu_num_per_node=1 \
# --model_update="momentum" \
# --learning_rate=0.001 \
# --loss_print_every_n_iter=1 \
# --batch_size_per_device=16 \
# --val_batch_size_per_device=10 \
# --num_epoch=10 \
# --model="resnet50"
# # training with imagenet
# DATA_ROOT=/datasets/ImageNet/ofrecord
# LOG_FOLDER=../logs
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册