Downloads · 30 days
14
2% of all-time downloads
onkarsus13/ConFiDeNet-Large-VQ-32
ConFiDeNet-Large-VQ-32 is a machine learning model from onkarsus13. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
This is the Offical weights of ConFiDeNet
Downloads · 30 days
14
2% of all-time downloads
All-time downloads
782
Public
Parameters
952M
1.9 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.9 GB · 100%
From the Hugging Face model README
This is the Offical weights of ConFiDeNet
Installation
pip3 install git+https://github.com/Onkarsus13/transformers.git@confidenet
from PIL import Image
import torch
from transformers import ConFiDeNetForDepthEstimation, ConFiDeNetImageProcessor
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
image = Image.open("<Image Path>").convert("RGB")
print(image.size)
# image.save("image.jpg")
image_processor = ConFiDeNetImageProcessor.from_pretrained("onkarsus13/ConFiDeNet-Large-VQ-32")
model = ConFiDeNetForDepthEstimation.from_pretrained("onkarsus13/ConFiDeNet-Large-VQ-32").to(device)
inputs = image_processor(images=image, return_tensors="pt").to(device)
with torch.no_grad():
outputs = model(**inputs)
post_processed_output = image_processor.post_process_depth_estimation(
outputs, target_sizes=[(image.height, image.width)],
)
depth = post_processed_output[0]["predicted_depth_uint16"].detach().cpu().numpy()
depth = Image.fromarray(depth, mode="I;16")
depth.save("depth.png")