Edit model card

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)
Downloads last month
0
Unable to determine this model's library. Check the docs .