mirror of
https://github.com/xuebinqin/DIS.git
synced 2024-11-26 08:43:17 +01:00
Inference.py modified
This commit is contained in:
parent
9a37251d6b
commit
3e90a9109d
@ -17,9 +17,9 @@ from models import *
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
dataset_path="" #Your dataset path
|
dataset_path="/home/jiayi.zhu/DIS_projects/demo" #Your dataset path
|
||||||
model_path="" #Your model path
|
model_path="/home/jiayi.zhu/DIS_projects/saved_models/IS-Net-New/gpu_itr_654000_traLoss_0.1955_traTarLoss_0.0186_valLoss_0.9414_valTarLoss_0.1418_maxF1_0.9117_mae_0.0388_time_0.030502.pth" #Your model path
|
||||||
result_path="" #The folder path that you want to save the results
|
result_path="/home/jiayi.zhu/DIS_projects/demo_result" #The folder path that you want to save the results
|
||||||
input_size=[1024,1024]
|
input_size=[1024,1024]
|
||||||
net=ISNetDIS()
|
net=ISNetDIS()
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
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")
|
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")
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user