File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
2
import wget
3
+ import shutil
3
4
import zipfile
5
+ import argparse
4
6
5
- def main ():
6
- wget .download (
7
- 'https://github.com/FanChiMao/Competition-2024-PyTorch-Tracking/releases/download/v0.0/demo_images.zip' )
7
+ def main (target_path ):
8
+ target_path = os .path .abspath (target_path )
9
+ wget .download ('https://github.com/FanChiMao/Competition-2024-PyTorch-Tracking/releases/download/v0.0/demo_images.zip' ,
10
+ out = target_path )
8
11
9
12
try :
10
13
print ("Start download the demo images..." )
11
- if os .path .exists ("./demo_images.zip" ):
12
- with zipfile .ZipFile (" demo_images.zip" ) as zip_ref :
13
- zip_ref .extractall ("." )
14
+ if os .path .exists (os . path . join ( target_path , "./demo_images.zip" ) ):
15
+ with zipfile .ZipFile (os . path . join ( target_path , "./ demo_images.zip") ) as zip_ref :
16
+ zip_ref .extractall (target_path )
14
17
except Exception as error :
15
18
print (f"Error Exception: { error } " )
16
19
finally :
17
- if os .path .exists ("./demo_images.zip" ):
18
- os .remove ("./demo_images.zip" )
20
+ if os .path .exists (os . path . join ( target_path , "./demo_images.zip" ) ):
21
+ os .remove (os . path . join ( target_path , "./demo_images.zip" ) )
19
22
20
23
21
24
if __name__ == '__main__' :
22
- main ()
25
+ parser = argparse .ArgumentParser ()
26
+ parser .add_argument ('--target_path' , type = str , default = "." )
27
+ args = parser .parse_args ()
28
+ main (args .target_path )
Original file line number Diff line number Diff line change 1
1
import os
2
- import sys
3
- sys .path .append ("Detector" )
4
2
5
3
print (">> Download pretrained weights" )
6
4
try :
15
13
os .makedirs ("assets" , exist_ok = True )
16
14
if not os .path .exists ("assets/demo_images" ):
17
15
try :
18
- os .system ("python assets/download_demo_images.py" )
16
+ os .system ("python assets/download_demo_images.py --target_path assets " )
19
17
if not os .path .exists ("assets/demo_images" ):
20
18
raise "demo_images doesn't exist"
21
19
except Exception as error :
You can’t perform that action at this time.
0 commit comments