Пример #1
0
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')
args = parser.parse_args()
Пример #2
0
                    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
    nav = nav_maker.get()
    return nav
Пример #3
0
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",
                    help='name of the script')
parser.add_argument('-s',
                    '--save',