Skip to content

Commit

Permalink
fix data prepare issue
Browse files Browse the repository at this point in the history
  • Loading branch information
MendelXu committed Sep 9, 2021
1 parent ba4b1ab commit 323a06c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/dataset/semi_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,16 @@ def _save_anno(name, images, annotations):
version=version, seed=seed, tot=int(percent)
)
_save_anno(save_name, unlabeled_images, unlabeled_annotations)

#construct 120k unlabeled data
unlabeled_ann_file = os.path.join(COCOANNODIR, "instances_unlabeled{}.json".format(version))
if not os.path.exists(unlabeled_ann_file):
unlabeled_info = json.load(
open(os.path.join(COCOANNODIR, "image_info_unlabeled{}.json".format(version)))
)
unlabeled_info["annotations"] = []
unlabeled_info["categories"] = anno["categories"]
print(">> Data {}.json saved({} images {} annotations)".format(unlabeled_ann_file,len(unlabeled_info["images"]),len(unlabeled_info["annotations"])))
json.dump(unlabeled_info,open(os.path.join(COCOANNODIR, "instances_unlabeled{}.json".format(version)),'w'))

if __name__ == "__main__":

Expand Down

0 comments on commit 323a06c

Please sign in to comment.