Skip to content

Commit c8cc7b2

Browse files
authored
Merge pull request VainF#72 from Dawars/fix_image_loading_path
Fix path when image name contains multiple dots
2 parents e0ee476 + d00e65e commit c8cc7b2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

predict.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ def main():
121121
with torch.no_grad():
122122
model = model.eval()
123123
for img_path in tqdm(image_files):
124-
img_name = os.path.basename(img_path).split('.')[0]
124+
ext = os.path.basename(img_path).split('.')[-1]
125+
img_name = os.path.basename(img_path)[:-len(ext)-1]
125126
img = Image.open(img_path).convert('RGB')
126127
img = transform(img).unsqueeze(0) # To tensor of NCHW
127128
img = img.to(device)

0 commit comments

Comments
 (0)