@@ -235,30 +235,8 @@ def train(**args):
235
235
try :
236
236
image_dir = tempfile .TemporaryDirectory ()
237
237
# mount_nextcloud('rshare:/data/dataset_files', paths.get_splits_dir())
238
- print ("mount_nextcloud" )
239
- mount_nextcloud ('rshare:/data/images' , image_dir .name )
240
- nom_du_fichier_zip = os .listdir (os .path .join (image_dir .name ,'images' ))[0 ]
241
- print (">> RSHARE" ,os .listdir (os .path .join (image_dir .name ,'images' )))
242
-
243
- output_zip_path = os .path .join (image_dir .name ,'images' ,nom_du_fichier_zip )
244
- print ("output_zip_path" ,output_zip_path )
245
-
246
- zip_dir = tempfile .TemporaryDirectory ()
247
- with ZipFile (output_zip_path ,'r' ) as zipObject :
248
- listOfFileNames = zipObject .namelist ()
249
- # print(listOfFileNames)
250
- for i in range (len (listOfFileNames )):
251
- zipObject .extract (listOfFileNames [i ],path = zip_dir .name )
252
- A1 = [os .path .join (zip_dir .name ,ix ) for ix in os .listdir (zip_dir .name )]
253
- # print("A1 ",A1)
254
- verif = A1 [0 ].split ('\\ ' )
255
- if verif [- 1 ]== 'images' :
256
- path_image_data = A1 [0 ]
257
- path_masks_data = A1 [1 ]
258
- else :
259
- path_image_data = A1 [1 ]
260
- path_masks_data = A1 [0 ]
261
-
238
+ mount_nextcloud ('rshare:/data/images' , os .path .join (image_dir .name ,'images' ))
239
+ print (">> RSHARE" ,os .listdir (os .path .join (image_dir .name ,'images' )))
262
240
except Exception as e :
263
241
print (e )
264
242
if link_zip_file_images != "None" :
@@ -290,28 +268,17 @@ def train(**args):
290
268
path_image_data = cfg .DATA_IMAGE
291
269
path_masks_data = cfg .DATA_MASK
292
270
293
- path_image_data = cfg .DATA_IMAGE
294
- path_masks_data = cfg .DATA_MASK
295
-
296
271
# Model zip
297
272
output_dir_model = tempfile .TemporaryDirectory ()
298
273
output_path_dir_model = output_dir_model .name
299
-
300
- # mount_nextcloud('rshare:/data/dataset_files', paths.get_splits_dir())
301
- mount_nextcloud ('rshare:/data/models' , output_dir_model .name )
302
- nom_du_fichier_zip = os .listdir (os .path .join (output_dir_model .name ,'models' ))[0 ]
303
- print (">> RSHARE" ,os .listdir (os .path .join (output_dir_model .name ,'models' )))
304
274
305
- output_zip_path = os .path .join (output_dir_model .name ,'images' ,nom_du_fichier_zip )
306
- print ("output_zip_path model" ,output_zip_path )
307
-
308
- # link_zip_file_model = yaml.safe_load(args["Link_model"])
309
- # id_file_model = link_zip_file_model.split('/')[-2]
310
- # url_model = "https://drive.google.com/uc?export=download&id="+id_file_model
275
+ link_zip_file_model = yaml .safe_load (args ["Link_model" ])
276
+ id_file_model = link_zip_file_model .split ('/' )[- 2 ]
277
+ url_model = "https://drive.google.com/uc?export=download&id=" + id_file_model
311
278
312
- # output_zip_path = os.path.join(output_path_dir_model,'models_images.zip')
279
+ output_zip_path = os .path .join (output_path_dir_model ,'models_images.zip' )
313
280
print ("Loading.." )
314
- # gdown.download(url_model, output_zip_path, quiet=False)
281
+ gdown .download (url_model , output_zip_path , quiet = False )
315
282
# print(">>> output_dir_model",output_dir_model)
316
283
with ZipFile (output_zip_path ,'r' ) as zipObject :
317
284
listOfFileNames = zipObject .namelist ()
0 commit comments