Exemplo n.º 1
0
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import os

sys.path.append("..")
from models.model import ConvLSTMMulti
import argparse
from args import init_parser, post_processing
import cv2
from utils import generate_guide_grid, PiecewiseSchedule, monitor_guide, draw_from_pred, from_variable_to_numpy
from utils.util import norm_image
import numpy as np
from actionsampler import ActionSampleManager

parser = argparse.ArgumentParser(description="sim2real")
init_parser(parser)
args = parser.parse_args()
args = post_processing(args)


def draw_output(args, obs, output, action, guidance, guidance_distri, index):
    # draw the visualization for the current frame
    h, w = obs.shape[0], obs.shape[1]
    seg_canvas = np.zeros((h, w * 11, 3))
    for i in range(11):
        img = draw_from_pred(
            args,
            from_variable_to_numpy(
                torch.argmax(output['seg_pred'][0, i + 1], 0)))
        img = cv2.resize(img, (w, h))
        seg_canvas[:, w * i:w * (i + 1)] = img
Exemplo n.º 2
0
from envs import make_env

# find the carla module
import glob
import os
import sys
import cv2
import math
import random
import time
import torch
from envs.CARLA.carla_lib.carla.client import make_carla_client
from envs.CARLA.carla_env import CarlaEnv

parser = argparse.ArgumentParser(description='SPC')
init_parser(parser)  # See `args.py` for default arguments
args = parser.parse_args()
args = post_processing(args)
args.recording_frame = True
args.monitor = True
args.use_depth = True
args.port = 2666
args.vehicle_num = 128
args.use_detection = True
args.frame_width = 512
args.frame_height = 256
args.use_3d_detection = True

save_path = 'carla_datasetv4'
if not os.path.isdir(save_path):
    os.makedirs(save_path)
Exemplo n.º 3
0
        start_button.close()
        stop_button.close()
        end_button.close()

        camera.close()

        exit(0)


def run():
    os.system(f"flite -voice rms -t {'System ready'.__repr__()}")
    signal.pause()


# Load options based on argparser
args = init_parser()

# Set up PiCamera globally so main() doesn't create an instance each time
camera = picamera.PiCamera(resolution=(args.width, args.height), framerate=90)

# Set up pins
start_button = Button(args.start)
stop_button = Button(args.stop)
end_button = Button(args.kill)

start_button.when_pressed = main
stop_button.when_pressed = stop
end_button.when_pressed = kill_process

# Log GPS Coordinates
logger = Logger()