Пример #1
0
global_trans_costmap_list = []
global_trans_costmap_dict = {}


MAX_SPEED = 30
img_height = 128
img_width = 256
#longitudinal_length = 25.0 # [m]

random.seed(datetime.now())
torch.manual_seed(999)
torch.cuda.manual_seed(999)
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')

generator = GeneratorUNet()
generator = generator.to(device)
model = ModelGRU().to(device)
generator.eval()
model.eval()

parser = argparse.ArgumentParser(description='Params')
parser.add_argument('-d', '--data', type=int, default=1, help='data index')
parser.add_argument('-s', '--save', type=bool, default=False, help='save result')
parser.add_argument('--width', type=int, default=400, help='image width')
parser.add_argument('--height', type=int, default=200, help='image height')
parser.add_argument('--max_dist', type=float, default=25., help='max distance')
parser.add_argument('--max_t', type=float, default=3., help='max time')
parser.add_argument('--scale', type=float, default=25., help='longitudinal length')
parser.add_argument('--dt', type=float, default=0.03, help='discretization minimum time interval')
parser.add_argument('--rnn_steps', type=int, default=10, help='rnn readout steps')
Пример #2
0
parser = argparse.ArgumentParser()
parser.add_argument('--img_height',
                    type=int,
                    default=128,
                    help='size of image height')
parser.add_argument('--img_width',
                    type=int,
                    default=256,
                    help='size of image width')
opt = parser.parse_args()

random.seed(datetime.now())
torch.manual_seed(999)

device = torch.device('cpu')
generator = GeneratorUNet()

generator = generator.to(device)
generator.load_state_dict(torch.load('../../ckpt/g.pth', map_location=device))
generator.eval()

img_trans_ = [
    transforms.Resize((opt.img_height, opt.img_width), Image.BICUBIC),
    transforms.ToTensor(),
    transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),
]
img_trans = transforms.Compose(img_trans_)


def get_nav():
    global nav_maker
Пример #3
0
if not opt.eval:
    logger = SummaryWriter(log_dir=log_path)
    write_params(log_path, parser, description)
    

device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# Loss functions
criterion_GAN = torch.nn.MSELoss()
criterion_pixelwise = torch.nn.L1Loss()

# Loss weight of L1 pixel-wise loss between translated image and real image
lambda_pixel = 100
# Calculate output of image discriminator (PatchGAN)
patch = (1, opt.img_height//2**4, opt.img_width//2**4)

generator = GeneratorUNet()
discriminator = Discriminator()

generator = generator.to(device)
discriminator = discriminator.to(device)
#generator.load_state_dict(torch.load('../../ckpt/sim/g.pth'))
#discriminator.load_state_dict(torch.load('../../ckpt/sim/d.pth'))

criterion_GAN.to(device)
criterion_pixelwise.to(device)
#unet encode

# Optimizers
optimizer_G = torch.optim.Adam(generator.parameters(), lr=opt.lr, betas=(opt.b1, opt.b2))
optimizer_D = torch.optim.Adam(discriminator.parameters(), lr=opt.lr, betas=(opt.b1, opt.b2))
Пример #4
0
global_img = None
global_pcd = None
global_nav = None
global_vel = 0.

MAX_SPEED = 20
img_height = 128
img_width = 256
longitudinal_length = 25.0 # [m]

random.seed(datetime.now())
torch.manual_seed(999)
torch.cuda.manual_seed(999)
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')

generator = GeneratorUNet()
generator = generator.to(device)
generator.load_state_dict(torch.load('../ckpt/sim/g.pth'))
model = Model_COS().to(device)
model.load_state_dict(torch.load('../ckpt/sim/model.pth'))
generator.eval()
model.eval()

parser = argparse.ArgumentParser(description='Params')
parser.add_argument('-d', '--data', type=int, default=1, help='data index')
parser.add_argument('-n', '--num', type=int, default=100000, help='total number')
parser.add_argument('--width', type=int, default=400, help='image width')
parser.add_argument('--height', type=int, default=200, help='image height')
parser.add_argument('--max_dist', type=float, default=20., help='max distance')
parser.add_argument('--max_t', type=float, default=5., help='max time')
parser.add_argument('--scale', type=float, default=25., help='longitudinal length')
Пример #5
0
global_dict['plan_map'] = None
global_dict['transform'] = None
global_dict['draw_cost_map'] = None
global_dict['max_steer_angle'] = 0.
global_dict['ipm_image'] = np.zeros((200, 400), dtype=np.uint8)
global_dict['ipm_image'].fill(255)
global_dict['trans_costmap_dict'] = {}
global_dict['state0'] = None
global_dict['start_control'] = False

random.seed(datetime.now())
torch.manual_seed(999)
torch.cuda.manual_seed(999)
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')

generator = GeneratorUNet()
generator = generator.to(device)
generator.load_state_dict(
    torch.load('/home/cz/Downloads/learning-uncertainty-master/scripts/g.pth'))
trajectory_model = Generator(4).to(device)
trajectory_model.load_state_dict(
    torch.load(
        '/home/cz/Downloads/learning-uncertainty-master/scripts/generator_1924000.pth'
    ))
trajectory_model.eval()
generator.eval()

parser = argparse.ArgumentParser(description='Params')
parser.add_argument('--name',
                    type=str,
                    default="rl-train-08",