[Bug] Fix bug in collect_results (#114)

* fix bug in collect results

* fix compatibility issue in build.yml

* fix compatibility issue in build.yml

* revert changes in ci

* add comments
pull/119/head
LXXXXR 2020-12-18 17:00:47 +08:00 committed by GitHub
parent 384ff95479
commit 6331eb3e2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -106,7 +106,11 @@ def collect_results_cpu(result_part, size, tmpdir=None):
part_list = []
for i in range(world_size):
part_file = osp.join(tmpdir, f'part_{i}.pkl')
part_list.append(mmcv.load(part_file))
part_result = mmcv.load(part_file)
# When data is severely insufficient, an empty part_result
# on a certain gpu could makes the overall outputs empty.
if part_result:
part_list.append(part_result)
# sort the results
ordered_results = []
for res in zip(*part_list):
@ -140,8 +144,11 @@ def collect_results_gpu(result_part, size):
if rank == 0:
part_list = []
for recv, shape in zip(part_recv_list, shape_list):
part_list.append(
pickle.loads(recv[:shape[0]].cpu().numpy().tobytes()))
part_result = pickle.loads(recv[:shape[0]].cpu().numpy().tobytes())
# When data is severely insufficient, an empty part_result
# on a certain gpu could makes the overall outputs empty.
if part_result:
part_list.append(part_result)
# sort the results
ordered_results = []
for res in zip(*part_list):