Logging tweaks
This commit is contained in:
parent
27565d919e
commit
9b39d7cd9b
3 changed files with 14 additions and 15 deletions
|
@ -13,13 +13,18 @@ logger = logging.getLogger("trap.plumbing")
|
||||||
def start():
|
def start():
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
loglevel = logging.NOTSET if args.verbose > 1 else logging.DEBUG if args.verbose > 0 else logging.INFO
|
loglevel = logging.NOTSET if args.verbose > 1 else logging.DEBUG if args.verbose > 0 else logging.INFO
|
||||||
|
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=loglevel,
|
level=loglevel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# set per handler, so we can set it lower for the root logger if remote logging is enabled
|
||||||
|
root_logger = logging.getLogger()
|
||||||
|
[h.setLevel(loglevel) for h in root_logger.handlers]
|
||||||
|
|
||||||
|
|
||||||
if args.remote_log_addr:
|
if args.remote_log_addr:
|
||||||
logging.captureWarnings(True)
|
logging.captureWarnings(True)
|
||||||
root_logger = logging.getLogger()
|
|
||||||
root_logger.setLevel(logging.NOTSET) # to send all records to cutelog
|
root_logger.setLevel(logging.NOTSET) # to send all records to cutelog
|
||||||
socket_handler = SocketHandler(args.remote_log_addr, args.remote_log_port)
|
socket_handler = SocketHandler(args.remote_log_addr, args.remote_log_port)
|
||||||
root_logger.addHandler(socket_handler)
|
root_logger.addHandler(socket_handler)
|
||||||
|
|
|
@ -301,7 +301,7 @@ class InferenceServer:
|
||||||
robot_present_and_future=robot_present_and_future,
|
robot_present_and_future=robot_present_and_future,
|
||||||
full_dist=True)
|
full_dist=True)
|
||||||
end = time.time()
|
end = time.time()
|
||||||
logger.info("t=%d: took %.2f s (= %.2f Hz) w/ %d nodes and %d edges" % (timestep, end - start,
|
logger.debug("took %.2f s (= %.2f Hz) w/ %d nodes and %d edges" % (end - start,
|
||||||
1. / (end - start), len(trajectron.nodes),
|
1. / (end - start), len(trajectron.nodes),
|
||||||
trajectron.scene_graph.get_num_edges()))
|
trajectron.scene_graph.get_num_edges()))
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ class InferenceServer:
|
||||||
}
|
}
|
||||||
|
|
||||||
data = json.dumps(response)
|
data = json.dumps(response)
|
||||||
logger.info(f"Frame delay = {time.time()-frame.time}s")
|
logger.info(f"Total frame delay = {time.time()-frame.time}s ({len(trajectron.nodes)} nodes & {trajectron.scene_graph.get_num_edges()} edges. Trajectron: {end - start}s)")
|
||||||
self.prediction_socket.send_string(data)
|
self.prediction_socket.send_string(data)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,16 +56,9 @@ class Tracker:
|
||||||
def track(self):
|
def track(self):
|
||||||
while True:
|
while True:
|
||||||
msg = self.frame_sock.recv()
|
msg = self.frame_sock.recv()
|
||||||
# after block, exhaust the queue: (superfluous now that CONFLATE is before the connect)
|
frame: Frame = pickle.loads(msg) # frame delivery in current setup: 0.012-0.03s
|
||||||
# i = 1
|
# logger.info(f"Frame delivery delay = {time.time()-frame.time}s")
|
||||||
# while True:
|
start_time = time.time()
|
||||||
# try:
|
|
||||||
# msg = self.frame_sock.recv(zmq.NOBLOCK)
|
|
||||||
# i+=1
|
|
||||||
# except Exception as e:
|
|
||||||
# break
|
|
||||||
frame: Frame = pickle.loads(msg)
|
|
||||||
logger.info(f"Frame delivery delay = {time.time()-frame.time}s")
|
|
||||||
detections = self.detect_persons(frame.img)
|
detections = self.detect_persons(frame.img)
|
||||||
tracks: [Track] = self.mot_tracker.update_tracks(detections, frame=frame.img)
|
tracks: [Track] = self.mot_tracker.update_tracks(detections, frame=frame.img)
|
||||||
|
|
||||||
|
@ -84,10 +77,11 @@ class Tracker:
|
||||||
"id": tid,
|
"id": tid,
|
||||||
"history": [{"x":c[0], "y":c[1]} for c in coords] # already doubles nested, fine for test
|
"history": [{"x":c[0], "y":c[1]} for c in coords] # already doubles nested, fine for test
|
||||||
}
|
}
|
||||||
logger.debug(f"{trajectories}")
|
# logger.debug(f"{trajectories}")
|
||||||
frame.trajectories = trajectories
|
frame.trajectories = trajectories
|
||||||
|
|
||||||
logger.info(f"trajectory delay = {time.time()-frame.time}s")
|
current_time = time.time()
|
||||||
|
logger.debug(f"Trajectories: {len(trajectories)}. Current frame delay = {current_time-frame.time}s (trajectories: {current_time - start_time}s)")
|
||||||
self.trajectory_socket.send(pickle.dumps(frame))
|
self.trajectory_socket.send(pickle.dumps(frame))
|
||||||
# self.trajectory_socket.send_string(json.dumps(trajectories))
|
# self.trajectory_socket.send_string(json.dumps(trajectories))
|
||||||
# provide a {ID: {id: ID, history: [[x,y],[x,y],...]}}
|
# provide a {ID: {id: ID, history: [[x,y],[x,y],...]}}
|
||||||
|
|
Loading…
Reference in a new issue