MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / main

Function main

train_net.py:393–418  ·  view source on GitHub ↗
(args=None)

Source from the content-addressed store, hash-verified

391
392
393def main(args=None):
394 cfg = setup(args)
395 print("Command cfg:", cfg)
396 if args.eval_only:
397 model = Trainer.build_model(cfg)
398 DetectionCheckpointer(model, save_dir=cfg.OUTPUT_DIR).resume_or_load(
399 cfg.MODEL.WEIGHTS, resume=args.resume
400 )
401 res = Trainer.test(cfg, model)
402 if cfg.TEST.AUG.ENABLED:
403 res.update(Trainer.test_with_TTA(cfg, model))
404 return res
405
406 trainer = Trainer(cfg)
407 if len(args.lang_weight)>0:
408 # load language weight for semantic
409 import copy
410 weight = copy.deepcopy(trainer.cfg.MODEL.WEIGHTS)
411 trainer.cfg.MODEL.WEIGHTS = args.lang_weight
412 print("load original language language weight!!!!!!")
413 trainer.resume_or_load(resume=args.resume)
414 trainer.cfg.MODEL.WEIGHTS = weight
415 print("load pretrained model weight!!!!!!")
416 trainer.resume_or_load(resume=args.resume)
417
418 return trainer.train()
419
420if __name__ == "__main__":
421 # main()

Callers

nothing calls this directly

Calls 6

setupFunction · 0.85
TrainerClass · 0.85
build_modelMethod · 0.80
testMethod · 0.80
updateMethod · 0.45
trainMethod · 0.45

Tested by

no test coverage detected