forked from autodistill/autodistill
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgroundingDIinoInference.py
More file actions
24 lines (17 loc) · 1.01 KB
/
Copy pathgroundingDIinoInference.py
File metadata and controls
24 lines (17 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from autodistill_grounding_dino import GroundingDINO
from autodistill.detection import CaptionOntology
base_model = GroundingDINO(ontology=CaptionOntology({"A person in black shirt":"Black Shirt"}))
base_model.label("D:\Datasets\COCO Test60 - Copy", extension =".jpg",batch_size=10)
# from autodistill_grounding_dino import GroundingDINO
# from autodistill.detection import CaptionOntology
# # Define an ontology to map class names to our GroundingDINO prompt
# ontology = CaptionOntology({"A person in black shirt":"Black Shirt"})
# # Load the model with the defined ontology
# base_model = GroundingDINO(ontology=ontology)
# # Check the weights
# def check_model_weights(model):
# # This function assumes the model has an accessible attribute for weights
# # Modify it according to your model's actual implementation
# for name, param in model.named_parameters():
# print(f"Layer: {name}, Weights: {param}")
# check_model_weights(base_model.model) # Assuming base_model.model is the actual model with weights