Ejemplo n.º 1
0
if not os.path.exists(opt.checkpoints_dir):
    os.makedirs(opt.checkpoints_dir)
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%Y/%m/%d %H:%M:%S', \
     filename=os.path.join(opt.checkpoints_dir, 'train.log'), level=logging.INFO)
logging.info('======================================================')
logging.info('weight: %f', opt.weight)
print(opt.pretrain_encoder, opt.pretrain_decoder, opt.pretrain_estimater)
logging.info('encoder=%s' % opt.pretrain_encoder)
logging.info('decoder=%s' % opt.pretrain_decoder)
logging.info('estimater=%s' % opt.pretrain_estimater)
if __name__ == '__main__':
    #if not os.path.exists(opt.train_record_dir):
    #   os.system(r"touch{}".format(opt.train_record_dir))

    #load data
    trainset = ICVL_Loader(opt.dataroot, 'train', opt)
    dataset_size = len(trainset)
    trainloader = torch.utils.data.DataLoader(trainset,
                                              batch_size=opt.batch_size,
                                              shuffle=True,
                                              num_workers=opt.nThreads)
    print('#training point clouds = %d' % len(trainset))

    testset = ICVL_Loader(opt.dataroot, 'test', opt)
    testloader = torch.utils.data.DataLoader(testset,
                                             batch_size=opt.batch_size,
                                             shuffle=False,
                                             num_workers=opt.nThreads)
    print('#testing point clouds = %d' % len(testset))
    visualizer = Visualizer(opt)
Ejemplo n.º 2
0
                    default=100,
                    help='weight of estimater, while weight of decoder is 1')

opt = parser.parse_args()
opt.device = torch.device("cuda:%d" %
                          (opt.gpu_id) if torch.cuda.is_available() else "cpu")
cuda.select_device(opt.gpu_id)

print(opt.pretrain_encoder, opt.pretrain_decoder, opt.pretrain_estimater)

if __name__ == '__main__':
    #if not os.path.exists(opt.train_record_dir):
    #   os.system(r"touch{}".format(opt.train_record_dir))

    #load data
    testset = ICVL_Loader(opt.dataroot, 'test', opt)
    testloader = torch.utils.data.DataLoader(testset,
                                             batch_size=opt.batch_size,
                                             shuffle=False,
                                             num_workers=opt.nThreads)
    print('#testing point clouds = %d' % len(testset))
    visualizer = Visualizer(opt)

    # create model, optionally load pre-trained model
    model = Model(opt)
    current_en_index = 0
    current_es_index = 0
    current_de_index = 0
    if opt.pretrain_encoder is not None:
        model.encoder.load_state_dict(torch.load(opt.pretrain_encoder))
        current_en_index = int(