Added a bit more exception handling.
This commit is contained in:
parent
d30b7ecd98
commit
0885df2da9
1 changed files with 169 additions and 157 deletions
|
|
@ -116,6 +116,7 @@ try:
|
|||
target_duration = 1. / float(fps)
|
||||
repeat = args.repeat_video != 0 and type(input_reader.reader) == VideoReader
|
||||
need_reinit = 0
|
||||
failures = 0
|
||||
source_name = input_reader.name
|
||||
while repeat or input_reader.is_open():
|
||||
if not input_reader.is_open() or need_reinit == 1:
|
||||
|
|
@ -161,6 +162,7 @@ try:
|
|||
if not args.video_out is None:
|
||||
out = cv2.VideoWriter(args.video_out, cv2.VideoWriter_fourcc('F','F','V','1'), 24, (width,height))
|
||||
|
||||
try:
|
||||
inference_start = time.perf_counter()
|
||||
faces = tracker.predict(frame)
|
||||
if len(faces) > 0:
|
||||
|
|
@ -326,6 +328,16 @@ try:
|
|||
with open(args.dump_points, "w") as fh:
|
||||
fh.write(repr(points))
|
||||
break
|
||||
failures = 0
|
||||
except Exception as e:
|
||||
if e.__class__ == KeyboardInterrupt:
|
||||
if args.silent == 0:
|
||||
print("Quitting")
|
||||
break
|
||||
traceback.print_exc()
|
||||
failures += 1
|
||||
if failures > 30:
|
||||
break
|
||||
|
||||
duration = time.perf_counter() - frame_time
|
||||
while duration < target_duration:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue