You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
811 B

from ultralytics.nn.tasks import DetectionModel
from ultralytics.yolo.utils.checks import check_yaml
def test_model_parser():
cfg = check_yaml("yolov8n.yaml") # check YAML
# Create model
model = DetectionModel(cfg)
model.info()
'''
# Options
if opt.line_profile: # profile layer by layer
model(im, profile=True)
elif opt.profile: # profile forward-backward
results = profile(input=im, ops=[model], n=3)
elif opt.test: # test all models
for cfg in Path(ROOT / 'models').rglob('yolo*.yaml'):
try:
_ = Model(cfg)
except Exception as e:
print(f'Error in {cfg}: {e}')
else: # report fused model summary
model.fuse()
'''
if __name__ == "__main__":
test_model_parser()