Skip to content

Commit 017a99b

Browse files
committed
test
1 parent 4d157ca commit 017a99b

1 file changed

Lines changed: 29 additions & 27 deletions

File tree

yolo/dataloaders/yolo_input_test.py

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,32 @@ def test_yolo_input_task():
3131
# boxes = ['(10, 14)', '(23, 27)', '(37, 58)', '(81, 82)', '(135, 169)', '(344, 319)'],
3232
# boxes = ["(10, 13)", "(16, 30)", "(33, 23)","(30, 61)", "(62, 45)", "(59, 119)","(116, 90)", "(156, 198)", "(373, 326)"],
3333
# boxes = ['(10, 14)', '(23, 27)', '(37, 58)', '(81, 82)'], #, '(135, 169)'])
34+
boxes=[
35+
'(12, 16)', '(19, 36)', '(40, 28)', '(36, 75)', '(76, 55)',
36+
'(72, 146)', '(142, 110)', '(192, 243)', '(459, 401)'
37+
],
3438
# boxes=[
35-
# '(12, 16)', '(19, 36)', '(40, 28)', '(36, 75)', '(76, 55)',
36-
# '(72, 146)', '(142, 110)', '(192, 243)', '(459, 401)'
39+
# '[15.0, 20.0]', '[23.0, 45.0]', '[50.0, 35.0]', '[45.0, 93.0]',
40+
# '[95.0, 68.0]', '[90.0, 182.0]', '[177.0, 137.0]',
41+
# '[240.0, 303.0]', '[573.0, 501.0]'
3742
# ],
38-
boxes = ['[15.0, 20.0]',
39-
'[23.0, 45.0]',
40-
'[50.0, 35.0]',
41-
'[45.0, 93.0]',
42-
'[95.0, 68.0]',
43-
'[90.0, 182.0]',
44-
'[177.0, 137.0]',
45-
'[240.0, 303.0]',
46-
'[573.0, 501.0]'],
4743
# boxes = None,
4844
filter=yolocfg.YoloLossLayer(nms_type="greedy")))
4945
task = yolo.YoloTask(config)
5046

5147
# loading both causes issues, but oen at a time is not issue, why?
48+
# config.train_data.global_batch_size = 64
49+
# config.validation_data.global_batch_size = 64
5250
config.train_data.dtype = 'float32'
5351
config.validation_data.dtype = 'float32'
54-
config.train_data.tfds_name = 'coco'
55-
config.validation_data.tfds_name = 'coco'
56-
config.train_data.tfds_split = 'train'
57-
config.validation_data.tfds_split = 'validation'
52+
# config.train_data.tfds_name = 'coco'
53+
# config.validation_data.tfds_name = 'coco'
54+
# config.train_data.tfds_split = 'train'
55+
# config.validation_data.tfds_split = 'validation'
56+
# config.train_data.tfds_data_dir = '/media/vbanna/DATA_SHARE/tfds'
57+
# config.validation_data.tfds_data_dir = '/media/vbanna/DATA_SHARE/tfds'
58+
config.train_data.input_path = '/media/vbanna/DATA_SHARE/CV/datasets/COCO_raw/records/train*'
59+
config.validation_data.input_path = '/media/vbanna/DATA_SHARE/CV/datasets/COCO_raw/records/val*'
5860
train_data = task.build_inputs(config.train_data)
5961
test_data = task.build_inputs(config.validation_data)
6062
return train_data, test_data
@@ -107,7 +109,7 @@ def test_yolo_pipeline(is_training=True):
107109
print(dataset, dsp)
108110
# shind = 3
109111
dip = 0
110-
drawer = utils.DrawBoxes(labels=coco.get_coco_names(), thickness=2)
112+
drawer = utils.DrawBoxes(labels=coco.get_coco_names(path="/home/vbanna/Research/TensorFlowModels/yolo/dataloaders/dataset_specs/coco-91.names"), thickness=2, classes=91)
111113
# dfilter = detection_generator.YoloFilter()
112114
ltime = time.time()
113115

@@ -166,28 +168,28 @@ def test_yolo_pipeline(is_training=True):
166168

167169
def time_pipeline():
168170
dataset, dsp = test_yolo_input_task()
169-
dataset = dataset.take(100000)
170-
print(dataset, dataset.cardinality())
171+
# dataset = dataset.take(100000)
172+
# print(dataset, dataset.cardinality())
171173
times = []
172174
ltime = time.time()
173175
for l, (i, j) in enumerate(dataset):
174176
ftime = time.time()
175177
# print(tf.reduce_min(i))
176178
# print(l , ftime - ltime, end = ", ")
177179

178-
gt = j['true_conf']
179-
inds = j['inds']
180-
181-
with tf.device('CPU:0'):
182-
test = tf.gather_nd(gt['3'], inds['3'], batch_dims=1)
183-
test = tf.gather_nd(gt['4'], inds['4'], batch_dims=1)
184-
test = tf.gather_nd(gt['5'], inds['5'], batch_dims=1)
185-
tf.print(test)
180+
# gt = j['true_conf']
181+
# inds = j['inds']
182+
183+
# with tf.device('CPU:0'):
184+
# test = tf.gather_nd(gt['3'], inds['3'], batch_dims=1)
185+
# test = tf.gather_nd(gt['4'], inds['4'], batch_dims=1)
186+
# test = tf.gather_nd(gt['5'], inds['5'], batch_dims=1)
187+
# tf.print(test)
186188

187189
times.append(ftime - ltime)
188190
ltime = time.time()
189191
print(times[-1], l)
190-
if l >= 80000:
192+
if l >= 100:
191193
break
192194

193195
plt.plot(times)

0 commit comments

Comments
 (0)