def main(cfg_file): print(cfg_file) cfg = load_cfg(cfg_file) data_loader = build_detection_train_loader(cfg) device = torch.device("cuda") model = build_model(cfg).to(device) for data in data_loader: ipdb.set_trace()
def test_model(cfg_file): # get cfg cfg = get_cfg() cfg.merge_from_file(cfg_file) cfg.SOLVER.IMS_PER_BATCH = 1 # get model device = torch.device("cuda") model = build_model(cfg).to(device) ipdb.set_trace()
def build_model(cls, cfg): """ Returns: torch.nn.Module: It now calls :func:`slender_det.modeling.build_model`. Overwrite it for using our own model. """ model = build_model(cfg) logger = logging.getLogger(__name__) logger.info("Model:\n{}".format(model)) return model
def test_training(cfg_file): # get cfg cfg = get_cfg() cfg.merge_from_file(cfg_file) cfg.SOLVER.IMS_PER_BATCH = 2 # get batch data data_loader = build_detection_train_loader(cfg) data_loader_iter = iter(data_loader) data = next(data_loader_iter) print(len(data)) # get model device = torch.device("cuda") model = build_model(cfg).to(device) model.train() outs = model(data[:2]) ipdb.set_trace()
from detectron2.data import MetadataCatalog, build_detection_train_loader from detectron2.checkpoint import DetectionCheckpointer import init_paths from slender_det.config import get_cfg from slender_det.modeling import build_model # get cfg cfg = get_cfg() cfg.merge_from_file("configs/rep-points/rep_pointsv2_R_50_FPN_1x.yaml") cfg.SOLVER.IMS_PER_BATCH = 2 # get model device = torch.device("cuda") model = build_model(cfg).to(device) # get batch data data_loader = build_detection_train_loader(cfg) data_loader_iter = iter(data_loader) data = next(data_loader_iter) def test_training(): model.train() outs = model(data[:2]) import pdb pdb.set_trace()
def test_load_pt(): model = build_model(cfg) ipdb.set_trace()
from detectron2.data import MetadataCatalog, build_detection_train_loader from detectron2.checkpoint import DetectionCheckpointer import init_paths from slender_det.config import get_cfg from slender_det.modeling.backbone import build_backbone from slender_det.modeling import build_model # get cfg cfg = get_cfg() cfg.merge_from_file("configs/corner/Base-CornerNet.yaml") # get model device = torch.device("cuda") model = build_model(cfg) # get batch data data_loader = build_detection_train_loader(cfg) data_loader_iter = iter(data_loader) data = next(data_loader_iter) def test_backbone(): backbone = build_backbone(cfg).to(device) images = torch.empty((2, 3, 512, 512)).to(device) assert isinstance(backbone, nn.Module) num = 0 for module in backbone.modules(): if isinstance(module, nn.Conv2d):