Downloads · 30 days
0
Andyrasika/GroundingDINO
GroundingDINO is a machine learning model from Andyrasika. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as creativeml-openrail-m.
Downloads · 30 days
0
Access
Public
Updated Aug 7, 2023
Repo size
8.7 GB
Likes
3
Public
Click a slice to open those files.
.pth8.7 GB · 100%
From the Hugging Face model README
Citations
@inproceedings{AndyRasika,
title={Grounding DINO: Marrying DINO v2 with Grounded Pre-Training for Open-Set Object Detection},
author={Ankush Singal},
year={2023}
}
def load_model_hf(repo_id, filename, ckpt_config_filename, device='cpu'):
cache_config_file = hf_hub_download(repo_id=repo_id, filename=ckpt_config_filename)
args = SLConfig.fromfile(cache_config_file)
model = build_model(args)
args.device = device
cache_file = hf_hub_download(repo_id=repo_id, filename=filename)
checkpoint = torch.load(cache_file, map_location='cpu')
log = model.load_state_dict(clean_state_dict(checkpoint['model']), strict=False)
print("Model loaded from {} \n => {}".format(cache_file, log))
_ = model.eval()
return model
ckpt_repo_id = "Andyrasika/GroundingDINO"
ckpt_filenmae = "groundingdino_swint_ogc.pth"
ckpt_config_filename = "GroundingDINO_SwinT_OGC.py"
model = load_model_hf(ckpt_repo_id, ckpt_filenmae, ckpt_config_filename)