Skip to content
Snippets Groups Projects
Commit 25326e4e authored by zhouneng's avatar zhouneng
Browse files

[yolov3_darknet53]bind cpu cores to speed up training

parent 952fd47d
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,7 @@ export DEVICE_NUM=1
export DEVICE_ID=0
export RANK_ID=0
export RANK_SIZE=1
export CPU_BIND_NUM=24
if [ -d "train" ];
then
......@@ -63,7 +64,18 @@ cd ./train || exit
echo "start training for device $DEVICE_ID"
env > env.log
python train.py \
cpus=`cat /proc/cpuinfo| grep "processor"| wc -l`
if [ $cpus -ge $CPU_BIND_NUM ]
then
start=`expr $cpus - $CPU_BIND_NUM`
end=`expr $cpus - 1`
else
start=0
end=`expr $cpus - 1`
fi
cmdopt=$start"-"$end
taskset -c $cmdopt python train.py \
--data_dir=$DATASET_PATH \
--pretrained_backbone=$PRETRAINED_BACKBONE \
--is_distributed=0 \
......
......@@ -167,7 +167,6 @@ def create_yolo_dataset(image_dir, anno_path, batch_size, max_epoch, device_num,
"gt_box1", "gt_box2", "gt_box3"]
if device_num != 8:
ds = de.GeneratorDataset(yolo_dataset, column_names=dataset_column_names,
num_parallel_workers=min(32, num_parallel_workers),
sampler=distributed_sampler)
ds = ds.batch(batch_size, per_batch_map=multi_scale_trans, input_columns=dataset_column_names,
num_parallel_workers=min(32, num_parallel_workers), drop_remainder=True)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment