예제 #1
0
#!/usr/bin/env python
import os, sys
import setlog

conf_file = os.environ['DEV'] + 'dl_management/.log/logging.yaml'
save_file = os.path.abspath(sys.argv[0])[:-len(sys.argv[0])] + 'log/'
setlog.reconfigure(conf_file, save_file)

import system.PoseRegression as System

if __name__ == '__main__':
    scene = 'indoor/apt1-kitchen'
    machine = System.MultNet(
        root=os.path.abspath(sys.argv[0])[:-len(sys.argv[0])],
        #trainer_file= '../relative_pnp.yaml',
        #trainer_file='../self_multiscale_depth_trainer.yaml',
        trainer_file='../nn_index.yaml',
        #trainer_file='../pnp-5-images.yaml',
        #trainer_file='../pnp-1-image.yaml',
        dataset_file='../../../../datasets/' + scene + '.yaml',
        cnn_type='../multiscale_cnn.yaml')
    action = input(
        'Exec:\n[t]\ttrain\n[e]\ttest\n[p]\tprint (console)\n[P]\tprint (full)\n[ ]\ttrain+test\n'
    )
    if action == 't':
        machine.train()
    elif action == 'e':
        machine.test()
        machine.plot(print_loss=False, print_val=False)
    elif action == 'ef':
        machine.test_on_final()
예제 #2
0
import setlog

file = '.log/logging.yaml'
root = '/home/nathan/Dev/Code/dl_management/'
setlog.reconfigure(file, root)

import torchvision
import matplotlib.pyplot as plt
import torch.utils.data as data
import datasets.multmodtf as tf
import datasets.SevenScene

logger = setlog.get_logger(__name__)


def show_batch(sample_batched):
    """Show image with landmarks for a batch of samples."""
    grid = torchvision.utils.make_grid(sample_batched['rgb'])
    plt.imshow(grid.numpy().transpose((1, 2, 0)))


def show_batch_mono(sample_batched):
    """Show image with landmarks for a batch of samples."""
    depth = sample_batched['depth']  # /torch.max(sample_batched['depth'])
    grid = torchvision.utils.make_grid(depth)
    plt.imshow(grid.numpy().transpose((1, 2, 0)))


if __name__ == '__main__':

    logger.debug('Beginning main')