Context manager open(file) as f fixes (#7289)
* Flask context manager `open()` fix * Additional read context manager fixes
This commit is contained in:
1 parent
2181ef371e
commit
5f97001ed4
5 files changed
+17
-6
No files matched your search
+2
-1
@@ -72,7 +72,8 @@ download: |
|
||||
imgs_path.mkdir(exist_ok=True, parents=True)
|
||||
lbs_path.mkdir(exist_ok=True, parents=True)
|
||||
|
||||
image_ids = open(path / f'VOC{year}/ImageSets/Main/{image_set}.txt').read().strip().split()
|
||||
with open(path / f'VOC{year}/ImageSets/Main/{image_set}.txt') as f:
|
||||
image_ids = f.read().strip().split()
|
||||
for id in tqdm(image_ids, desc=f'{image_set}{year}'):
|
||||
f = path / f'VOC{year}/JPEGImages/{id}.jpg' # old img path
|
||||
lb_path = (lbs_path / f.name).with_suffix('.txt') # new label path
|
||||
|
||||
Reference in new issue
Block a user