更新 'openi.py'
This commit is contained in:
parent
bead76aba0
commit
cfd888b880
33
openi.py
33
openi.py
|
@ -81,6 +81,29 @@ def obs_copy_folder(folder_dir, obs_folder_url):
|
|||
print('moxing upload {} to {} failed: '.format(folder_dir,obs_folder_url) + str(e))
|
||||
return
|
||||
|
||||
# def c2net_multidataset_to_env(multi_data_url, data_dir):
|
||||
# """
|
||||
# c2net copy single or multi dataset to training image
|
||||
# """
|
||||
# multi_data_json = json.loads(multi_data_url)
|
||||
# for i in range(len(multi_data_json)):
|
||||
# zipfile_path = data_dir + "/" + multi_data_json[i]["dataset_name"]
|
||||
# try:
|
||||
# mox.file.copy(multi_data_json[i]["dataset_url"], zipfile_path)
|
||||
# print("Successfully Download {} to {}".format(multi_data_json[i]["dataset_url"],zipfile_path))
|
||||
# #get filename and unzip the dataset
|
||||
# filename = os.path.splitext(multi_data_json[i]["dataset_name"])[0]
|
||||
# filePath = data_dir + "/" + filename
|
||||
# if not os.path.exists(filePath):
|
||||
# os.makedirs(filePath)
|
||||
# #If it is a tar compressed package, you can use os.system("tar -xvf {} {}".format(zipfile_path, filePath))
|
||||
# os.system("unzip {} -d {}".format(zipfile_path, filePath))
|
||||
|
||||
# except Exception as e:
|
||||
# print('moxing download {} to {} failed: '.format(
|
||||
# multi_data_json[i]["dataset_url"], zipfile_path) + str(e))
|
||||
# return
|
||||
|
||||
def c2net_multidataset_to_env(multi_data_url, data_dir):
|
||||
"""
|
||||
c2net copy single or multi dataset to training image
|
||||
|
@ -96,13 +119,17 @@ def c2net_multidataset_to_env(multi_data_url, data_dir):
|
|||
filePath = data_dir + "/" + filename
|
||||
if not os.path.exists(filePath):
|
||||
os.makedirs(filePath)
|
||||
#If it is a tar compressed package, you can use os.system("tar -xvf {} {}".format(zipfile_path, filePath))
|
||||
os.system("unzip {} -d {}".format(zipfile_path, filePath))
|
||||
if zipfile_path.endswith(".tar.gz"):
|
||||
os.system("tar -zxvf {} -C {}".format(zipfile_path, filePath))
|
||||
elif zipfile_path.endswith(".zip"):
|
||||
os.system("unzip {} -d {}".format(zipfile_path, filePath))
|
||||
else:
|
||||
print("The dataset is not in tar.gz or zip format!")
|
||||
|
||||
except Exception as e:
|
||||
print('moxing download {} to {} failed: '.format(
|
||||
multi_data_json[i]["dataset_url"], zipfile_path) + str(e))
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
class EnvToOpenIEpochEnd(Callback):
|
||||
|
|
Loading…
Reference in New Issue