forked from Zumbalamambo/tf-openpose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpose_datamaster.py
36 lines (28 loc) · 1.11 KB
/
pose_datamaster.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import argparse
import time
import logging
from tensorpack.dataflow.remote import RemoteDataZMQ
from pose_dataset import CocoPoseLMDB
logging.basicConfig(level=logging.DEBUG, format='[lmdb_dataset] %(asctime)s %(levelname)s %(message)s')
if __name__ == '__main__':
"""
Speed Test for Getting Input batches from other nodes
"""
parser = argparse.ArgumentParser(description='Worker for preparing input batches.')
parser.add_argument('--listen', type=str, default='tcp://0.0.0.0:1027')
parser.add_argument('--show', type=bool, default=False)
args = parser.parse_args()
df = RemoteDataZMQ(args.listen)
logging.info('tcp queue start')
df.reset_state()
t = time.time()
for i, dp in enumerate(df.get_data()):
if i == 100:
break
logging.info('Input batch %d received.' % i)
if i == 0:
for d in dp:
logging.info('%d dp shape={}'.format(d.shape))
if args.show:
CocoPoseLMDB.display_image(dp[0][0], dp[1][0], dp[2][0])
logging.info('Speed Test Done for 100 Batches in %f seconds.' % (time.time() - t))