@@ -572,21 +572,35 @@ def download(self, path=None, mode="pretrained", verbose=False,
572
572
"yolo_voc.json" )
573
573
if verbose :
574
574
print ("Downloading metadata..." )
575
- urlretrieve (file_url , os .path .join (path , "yolo_default.json" ))
575
+ if not os .path .exists (os .path .join (path , "yolo_default.json" )):
576
+ urlretrieve (file_url , os .path .join (path , "yolo_default.json" ))
577
+ if verbose :
578
+ print ("Downloaded metadata json." )
579
+ elif verbose :
580
+ print ("Metadata json file already exists." )
576
581
577
582
if verbose :
578
583
print ("Downloading params..." )
579
584
file_url = os .path .join (url , "pretrained" , "yolo_voc" ,
580
585
"yolo_voc.params" )
581
586
582
- urlretrieve (file_url ,
583
- os .path .join (path , "yolo_voc.params" ))
587
+ if not os .path .exists (os .path .join (path , "yolo_voc.params" )):
588
+ urlretrieve (file_url , os .path .join (path , "yolo_voc.params" ))
589
+ if verbose :
590
+ print ("Downloaded params." )
591
+ elif verbose :
592
+ print ("Params file already exists." )
584
593
585
594
elif mode == "images" :
586
595
file_url = os .path .join (url , "images" , "cat.jpg" )
587
596
if verbose :
588
597
print ("Downloading example image..." )
589
- urlretrieve (file_url , os .path .join (path , "cat.jpg" ))
598
+ if not os .path .exists (os .path .join (path , "cat.jpg" )):
599
+ urlretrieve (file_url , os .path .join (path , "cat.jpg" ))
600
+ if verbose :
601
+ print ("Downloaded example image." )
602
+ elif verbose :
603
+ print ("Example image already exists." )
590
604
591
605
elif mode == "test_data" :
592
606
os .makedirs (os .path .join (path , "test_data" ), exist_ok = True )
@@ -596,17 +610,32 @@ def download(self, path=None, mode="pretrained", verbose=False,
596
610
file_url = os .path .join (url , "test_data" , "train.txt" )
597
611
if verbose :
598
612
print ("Downloading filelist..." )
599
- urlretrieve (file_url , os .path .join (path , "test_data" , "train.txt" ))
613
+ if not os .path .exists (os .path .join (path , "test_data" , "train.txt" )):
614
+ urlretrieve (file_url , os .path .join (path , "test_data" , "train.txt" ))
615
+ if verbose :
616
+ print ("Downloaded filelist." )
617
+ elif verbose :
618
+ print ("Filelist already exists." )
600
619
# download image
601
620
file_url = os .path .join (url , "test_data" , "Images" , "000040.jpg" )
602
621
if verbose :
603
622
print ("Downloading image..." )
604
- urlretrieve (file_url , os .path .join (path , "test_data" , "Images" , "000040.jpg" ))
623
+ if not os .path .exists (os .path .join (path , "test_data" , "Images" , "000040.jpg" )):
624
+ urlretrieve (file_url , os .path .join (path , "test_data" , "Images" , "000040.jpg" ))
625
+ if verbose :
626
+ print ("Downloaded image." )
627
+ elif verbose :
628
+ print ("Image already exists." )
605
629
# download annotations
606
630
file_url = os .path .join (url , "test_data" , "Annotations" , "000040.jpg.txt" )
607
631
if verbose :
608
632
print ("Downloading annotations..." )
609
- urlretrieve (file_url , os .path .join (path , "test_data" , "Annotations" , "000040.jpg.txt" ))
633
+ if not os .path .exists (os .path .join (path , "test_data" , "Annotations" , "000040.jpg.txt" )):
634
+ urlretrieve (file_url , os .path .join (path , "test_data" , "Annotations" , "000040.jpg.txt" ))
635
+ if verbose :
636
+ print ("Downloaded annotations." )
637
+ elif verbose :
638
+ print ("Annotations already exist." )
610
639
611
640
def optimize (self , target_device ):
612
641
"""This method is not used in this implementation."""
0 commit comments