num_workers=2, ) train_set = Indoor3DSemSeg(args.num_points) train_loader = DataLoader( train_set, batch_size=args.batch_size, pin_memory=True, num_workers=2, shuffle=True, ) model = Pointnet(num_classes=13, input_channels=6, use_xyz=True) model.cuda() print(model) model_parameters = filter(lambda p: p.requires_grad, model.parameters()) params = sum([np.prod(p.size()) for p in model_parameters]) print("Model size = %i" % params) optimizer = optim.Adam(model.parameters(), lr=args.lr, weight_decay=args.weight_decay) lr_lbmd = lambda it: max( args.lr_decay**(int(it * args.batch_size / args.decay_step)), lr_clip / args.lr, ) bnm_lmbd = lambda it: max( args.bn_momentum * args.bn_decay** (int(it * args.batch_size / args.decay_step)), bnm_clip, )
pin_memory=True, num_workers=0, shuffle=True) model = Pointnet(num_classes=34, input_channels=6, use_xyz=True) # 设置设备 device_name = "cpu" if torch.cuda.is_available(): device_name = "cuda" torch.backends.cudnn.deterministic = True torch.cuda.manual_seed(0) device = torch.device(device_name) print(device) model.cuda() optimizer = optim.Adam(model.parameters(), lr=args.lr, weight_decay=args.weight_decay) lr_lbmd = lambda it: max( args.lr_decay** (int(it * args.batch_size / args.decay_step)), lr_clip / args.lr) bnm_lmbd = lambda it: max( args.bn_momentum * args.bn_decay** (int(it * args.batch_size / args.decay_step)), bnm_clip) if args.checkpoint is None: lr_scheduler = lr_sched.LambdaLR(optimizer, lr_lbmd) bnm_scheduler = pt_utils.BNMomentumScheduler(model, bnm_lmbd) start_epoch = 1 best_prec = 0
num_workers=2, ) train_set = Indoor3DSemSeg(args.num_points) train_loader = DataLoader( train_set, batch_size=args.batch_size, pin_memory=True, num_workers=2, shuffle=True, ) model = Pointnet(num_classes=13, input_channels=6, use_xyz=True) model.cuda() optimizer = optim.Adam( model.parameters(), lr=args.lr, weight_decay=args.weight_decay ) lr_lbmd = lambda it: max( args.lr_decay ** (int(it * args.batch_size / args.decay_step)), lr_clip / args.lr, ) bnm_lmbd = lambda it: max( args.bn_momentum * args.bn_decay ** (int(it * args.batch_size / args.decay_step)), bnm_clip, ) # default value it = -1 # for the initialize value of `LambdaLR` and `BNMomentumScheduler` best_loss = 1e10