Modify inference.py

This commit is contained in:
PiggyJerry 2023-01-26 12:10:39 +04:00
parent 996c9495d4
commit f3837183a3

View File

@ -30,6 +30,7 @@ if __name__ == "__main__":
net.load_state_dict(torch.load(model_path,map_location="cpu")) net.load_state_dict(torch.load(model_path,map_location="cpu"))
net.eval() net.eval()
im_list = glob(dataset_path+"/*.jpg")+glob(dataset_path+"/*.JPG")+glob(dataset_path+"/*.jpeg")+glob(dataset_path+"/*.JPEG")+glob(dataset_path+"/*.png")+glob(dataset_path+"/*.PNG")+glob(dataset_path+"/*.bmp")+glob(dataset_path+"/*.BMP")+glob(dataset_path+"/*.tiff")+glob(dataset_path+"/*.TIFF") im_list = glob(dataset_path+"/*.jpg")+glob(dataset_path+"/*.JPG")+glob(dataset_path+"/*.jpeg")+glob(dataset_path+"/*.JPEG")+glob(dataset_path+"/*.png")+glob(dataset_path+"/*.PNG")+glob(dataset_path+"/*.bmp")+glob(dataset_path+"/*.BMP")+glob(dataset_path+"/*.tiff")+glob(dataset_path+"/*.TIFF")
with torch.no_grad():
for i, im_path in tqdm(enumerate(im_list), total=len(im_list)): for i, im_path in tqdm(enumerate(im_list), total=len(im_list)):
print("im_path: ", im_path) print("im_path: ", im_path)
im = io.imread(im_path) im = io.imread(im_path)