MiDaS
MiDaS copied to clipboard
Module Usage
In prior versions of MiDaS you could just load the models and use them via modules. But now it seems with the new models you're left with only using the CLI script? That's not very conducive with usage. How can I run the latest model within my functions? I see no usage other the cumbersome CLI script
torch.hub.set_dir(self.midas_dir)
midas = torch.hub.load("intel-isl/MiDaS", midas_model, trust_repo=True)
device = torch.device("cuda") if torch.cuda.is_available(
) and use_cpu == 'false' else torch.device("cpu")
midas.to(device).eval()
midas_transforms = torch.hub.load("intel-isl/MiDaS", "transforms")
if midas_model == "DPT_Large" or midas_model == "DPT_Hybrid":
transform = midas_transforms.dpt_transform
else:
transform = midas_transforms.small_transform
# Do some predictions
The issue is PyTorch hub doesn't have the latest models. And even if you have them local, PyTorch Hub doesn't have the right conf
Anyone can help here?
Same issue please help with this.