Skip to content

Commit

Permalink
copy files from json
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanMolinier committed Dec 3, 2024
1 parent 4c9e03e commit 51c9e08
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions copy_files_from_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import json
import os
import shutil

def main():
keys_list = ['IMAGE', 'LABEL']
paths_out_list = ['/home/GRAMES.POLYMTL.CA/p118739/data/datasets/article-totalspineseg/canal-eval/raw', '/home/GRAMES.POLYMTL.CA/p118739/data/datasets/article-totalspineseg/canal-eval/gt']
path_json = '/home/GRAMES.POLYMTL.CA/p118739/data/config_data/canal-seg/dcm-oklahoma-brno_sci-paris.json'

with open(path_json, "r") as file:
config_data = json.load(file)

for dic in config_data['TESTING']:
for i, key in enumerate(keys_list):
img_path = os.path.join(config_data['DATASETS_PATH'], dic[key])
shutil.copy2(img_path, paths_out_list[i])

if __name__=='__main__':
main()

0 comments on commit 51c9e08

Please sign in to comment.