Fix frames vs. cpu cores issue
This commit is contained in:
parent
8b50aaf838
commit
dd5a321c50
@ -96,11 +96,14 @@ def pre_check():
|
|||||||
|
|
||||||
|
|
||||||
def start_processing():
|
def start_processing():
|
||||||
if args['gpu']:
|
|
||||||
process_video(args['source_img'], args["frame_paths"])
|
|
||||||
return
|
|
||||||
frame_paths = args["frame_paths"]
|
frame_paths = args["frame_paths"]
|
||||||
n = len(frame_paths) // (args['cores_count'])
|
n = len(frame_paths) // (args['cores_count'])
|
||||||
|
# single thread
|
||||||
|
if args['gpu'] or n < 2:
|
||||||
|
process_video(args['source_img'], args["frame_paths"])
|
||||||
|
return
|
||||||
|
# multi thread of frames to cpu cores ratio is 2
|
||||||
|
if n > 2:
|
||||||
processes = []
|
processes = []
|
||||||
for i in range(0, len(frame_paths), n):
|
for i in range(0, len(frame_paths), n):
|
||||||
p = pool.apply_async(process_video, args=(args['source_img'], frame_paths[i:i+n],))
|
p = pool.apply_async(process_video, args=(args['source_img'], frame_paths[i:i+n],))
|
||||||
|
Loading…
Reference in New Issue
Block a user