return(pred_val.detach().cpu().numpy()*255).astype(np.uint8)# it is the mask we need
# Set Parameters
hypar={}# paramters for inferencing
hypar["model_path"]="./saved_models"## load trained weights from this path
hypar["restore_model"]="isnet.pth"## name of the to-be-loaded weights
hypar["interm_sup"]=False## indicate if activate intermediate feature supervision
## choose floating point accuracy --
hypar["model_digit"]="full"## indicates "half" or "full" accuracy of float number
hypar["seed"]=0
hypar["cache_size"]=[1024,1024]## cached input spatial resolution, can be configured into different size
## data augmentation parameters ---
hypar["input_size"]=[1024,1024]## mdoel input spatial size, usually use the same value hypar["cache_size"], which means we don't further resize the images
hypar["crop_size"]=[1024,1024]## random crop size from the input, it is usually set as smaller than hypar["cache_size"], e.g., [920,920] for data augmentation
description="This is an unofficial demo for DIS, a model that can remove the background from a given image. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below.<br>GitHub: https://github.com/xuebinqin/DIS<br>Telegram bot: https://t.me/restoration_photo_bot<br>[![](https://img.shields.io/twitter/follow/DoEvent?label=@DoEvent&style=social)](https://twitter.com/DoEvent)"