fix coding mistakes

This commit is contained in:
zhouneng 2021-07-08 11:40:49 +08:00 committed by zhouneng2
parent f5dff92ebc
commit fe2058ab42
8 changed files with 12 additions and 21 deletions

View File

@ -17,7 +17,6 @@
export HCCL_CONNECT_TIMEOUT=600
export RANK_TABLE_FILE=$1
DATA_DIR=$2
DS_TYPE=$3
export RANK_SIZE=8
BASE_PATH=$(cd ./"`dirname $0`" || exit; pwd)
@ -50,7 +49,6 @@ do
env > env.log
taskset -c $cmdopt python -u ../train.py --config_path=$CONFIG_FILE \
--device_id $i \
--dataset_path=$DATA_DIR \
--ds_type=$DS_TYPE > log.txt 2>&1 &
--dataset_path=$DATA_DIR > log.txt 2>&1 &
cd ../
done

View File

@ -22,7 +22,6 @@ cp -r ./src ./device
cd ./device || exit
DATA_DIR=$1
DS_TYPE=$2
export DEVICE_ID=0
export RANK_SIZE=8
@ -32,4 +31,4 @@ CONFIG_FILE="${BASE_PATH}/../default_config_gpu.yaml"
echo "start training"
mpirun -n $RANK_SIZE --allow-run-as-root python train.py --config_path=$CONFIG_FILE --dataset_path=$DATA_DIR \
--platform='GPU' --ds_type=$DS_TYPE > train.log 2>&1 &
--platform='GPU' > train.log 2>&1 &

View File

@ -17,7 +17,6 @@
export DEVICE_ID=$1
DATA_DIR=$2
CHECKPOINT_PATH=$3
DS_TYPE=$4
export RANK_SIZE=1
BASE_PATH=$(cd ./"`dirname $0`" || exit; pwd)
@ -29,5 +28,5 @@ cd ./evaluation_ascend || exit
echo "start training for device id $DEVICE_ID"
env > env.log
python ../eval.py --config_path=$CONFIG_FILE --platform=Ascend --dataset_path=$DATA_DIR \
--checkpoint_path=$CHECKPOINT_PATH --ds_type=$DS_TYPE > eval.log 2>&1 &
--checkpoint_path=$CHECKPOINT_PATH > eval.log 2>&1 &
cd ../

View File

@ -23,11 +23,10 @@ cd ./evaluation || exit
DATA_DIR=$1
CKPT_DIR=$2
DS_TYPE=$3
BASE_PATH=$(cd ./"`dirname $0`" || exit; pwd)
CONFIG_FILE="${BASE_PATH}/../default_config_cpu.yaml"
echo "start evaluation"
python eval.py --config_path=$CONFIG_FILE --dataset_path=$DATA_DIR --checkpoint_path=$CKPT_DIR --platform='CPU' \
--ds_type=$DS_TYPE > eval.log 2>&1 &
python eval.py --config_path=$CONFIG_FILE --dataset_path=$DATA_DIR --checkpoint_path=$CKPT_DIR \
--platform='CPU' > eval.log 2>&1 &

View File

@ -26,11 +26,10 @@ export RANK_SIZE=1
DATA_DIR=$1
CKPT_DIR=$2
DS_TYPE=$3
BASE_PATH=$(cd ./"`dirname $0`" || exit; pwd)
CONFIG_FILE="${BASE_PATH}/../default_config_gpu.yaml"
echo "start evaluation"
python eval.py --config_path=$CONFIG_FILE --dataset_path=$DATA_DIR --checkpoint_path=$CKPT_DIR --platform='GPU' \
--ds_type=$DS_TYPE > eval.log 2>&1 &
python eval.py --config_path=$CONFIG_FILE --dataset_path=$DATA_DIR --checkpoint_path=$CKPT_DIR \
--platform='GPU' > eval.log 2>&1 &

View File

@ -17,7 +17,6 @@
export RANK_SIZE=1
export DEVICE_ID=$1
DATA_DIR=$2
DS_TYPE=$3
BASE_PATH=$(cd ./"`dirname $0`" || exit; pwd)
CONFIG_FILE="${BASE_PATH}/../default_config.yaml"
@ -28,6 +27,5 @@ echo "start training for device id $DEVICE_ID"
env > env.log
python -u ../train.py --config_path=$CONFIG_FILE \
--device_id=$1 \
--dataset_path=$DATA_DIR \
--ds_type=$DS_TYPE > log.txt 2>&1 &
--dataset_path=$DATA_DIR > log.txt 2>&1 &
cd ../

View File

@ -15,7 +15,6 @@
# ============================================================================
DATA_DIR=$1
DS_TYPE=$2
BASE_PATH=$(cd ./"`dirname $0`" || exit; pwd)
CONFIG_FILE="${BASE_PATH}/../default_config_cpu.yaml"
@ -25,5 +24,5 @@ mkdir ./train_standalone
cd ./train_standalone || exit
env > env.log
python -u ../train.py --config_path=$CONFIG_FILE \
--dataset_path=$DATA_DIR --platform=CPU --ds_type=$DS_TYPE > log.txt 2>&1 &
--dataset_path=$DATA_DIR --platform=CPU > log.txt 2>&1 &
cd ../

View File

@ -19,7 +19,7 @@ import copy
import numpy as np
from PIL import Image
import cv2
from model_utils.config import config
def _rand(a=0., b=1.):
return np.random.rand() * (b - a) + a
@ -550,13 +550,13 @@ class MultiScaleTrans:
if self.size_dict.get(seed_key, None) is None:
random.seed(seed_key)
new_size = random.choice(config.multi_scale)
new_size = random.choice(self.default_config.multi_scale)
self.size_dict[seed_key] = new_size
seed = seed_key
input_size = self.size_dict[seed]
for img, anno in zip(imgs, annos):
img, anno = preprocess_fn(img, anno, config, input_size, self.device_num, self.each_multiscale)
img, anno = preprocess_fn(img, anno, self.default_config, input_size, self.device_num, self.each_multiscale)
ret_imgs.append(img.transpose(2, 0, 1).copy())
bbox_true_1, bbox_true_2, bbox_true_3, gt_box1, gt_box2, gt_box3 = \
_preprocess_true_boxes(true_boxes=anno, anchors=self.anchor_scales, in_shape=img.shape[0:2],