MCPcopy Index your code
hub / github.com/OpenGVLab/HumanBench / common_process

Function common_process

PATH/core/solvers/utils/peddet_tester_dev.py:707–735  ·  view source on GitHub ↗
(func, data, nr_procs, *args)

Source from the content-addressed store, hash-verified

705 result_queue.put_nowait(result_dict)
706
707def common_process(func, data, nr_procs, *args):
708
709 total = len(data)
710 stride = math.ceil(total / nr_procs)
711 result_queue = Queue(10000)
712 results, procs = [], []
713 tqdm.monitor_interval = 0
714 pbar = tqdm(total = total, leave = False, ascii = True)
715 for i in range(nr_procs):
716 start = i*stride
717 end = np.min([start+stride,total])
718 sample_data = data[start:end]
719 # import pdb; pdb.set_trace()
720 # func(result_queue, sample_data, *args)
721 p = Process(target= func,args=(result_queue, sample_data, *args))
722 p.start()
723 procs.append(p)
724
725 for i in range(total):
726
727 t = result_queue.get()
728 if t is None:
729 pbar.update(1)
730 continue
731 results.append(t)
732 pbar.update()
733 for p in procs:
734 p.join()
735 return results
736
737def recover_func(bboxes):
738

Callers 1

computeJaccardFunction · 0.85

Calls 2

getMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected