Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add model object_detection four gpu card kpi #10

Merged
merged 1 commit into from
May 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion object_detection/continuous_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

train_cost_kpi = CostKpi('train_cost', 0.02, 0, actived=True)
train_speed_kpi = AccKpi('train_speed', 0.02, 0, actived=True)
four_card_speed_kpi = AccKpi('four_card_train_speed', 0.02, 0, actived=True)

tracking_kpis = [train_cost_kpi, train_speed_kpi]
tracking_kpis = [train_cost_kpi, train_speed_kpi, four_card_speed_kpi]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[93.72982281681011]
3 changes: 3 additions & 0 deletions object_detection/run.xsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ export CUDA_VISIBLE_DEVICES=$cudaid
# ./download.sh
#fi
FLAGS_benchmark=true FLAGS_fraction_of_gpu_memory_to_use=0.9 python train.py --batch_size=64 --num_passes=2
cudaid=${object_detection_multi_cudaid:=0,1,2,3} # use 0-th card as default
export CUDA_VISIBLE_DEVICES=$cudaid
FLAGS_benchmark=true FLAGS_fraction_of_gpu_memory_to_use=0.9 python train.py --batch_size=64 --num_passes=2 --gpu_card_num=4

13 changes: 10 additions & 3 deletions object_detection/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from mobilenet_ssd import mobile_net
from utility import add_arguments, print_arguments

from continuous_evaluation import train_cost_kpi, train_speed_kpi
from continuous_evaluation import train_cost_kpi, train_speed_kpi, four_card_speed_kpi

parser = argparse.ArgumentParser(description=__doc__)
add_arg = functools.partial(add_arguments, argparser=parser)
Expand All @@ -21,6 +21,7 @@
add_arg('num_passes', int, 120, "Epoch number.")
add_arg('iterations', int, 120, "mini batchs.")
add_arg('skip_batch_num', int, 5, "the num of minibatch to skip.")
add_arg('gpu_card_num', int, 1, "the num of gpu card.")
add_arg('parallel', bool, True, "Whether use parallel training.")
add_arg('use_gpu', bool, True, "Whether to use GPU or not.")
add_arg('use_nccl', bool, True, "Whether to use NCCL or not.")
Expand Down Expand Up @@ -318,8 +319,14 @@ def test(pass_id, best_map):
train_speed_kpi.add_record(
np.array(
examples_per_sec, dtype='float'))
train_cost_kpi.persist()
train_speed_kpi.persist()
four_card_speed_kpi.add_record(
np.array(
examples_per_sec, dtype='float'))
if args.gpu_card_num == 1:
train_cost_kpi.persist()
train_speed_kpi.persist()
else:
four_card_speed_kpi.persist()
print("Best test map {0}".format(best_map))


Expand Down