def __init__(self): super(Agent, self).__init__() self.p = Parameters() self.lane_detection_network = lane_detection_network() self.setup_optimizer() self.current_epoch = 0
def __init__(self): super(Agent, self).__init__() self.p = Parameters() self.lane_detection_network = lane_detection_network() self.lane_val = None self.current_epoch = 0 self.hard_sampling = hard_sampling.hard_sampling() print("model parameters: ") print(self.count_parameters(self.lane_detection_network))
def __init__(self, current_epoch=0): super(Agent, self).__init__() self.p = Parameters() self.lane_detection_network = lane_detection_network() self.setup_optimizer() self.current_epoch = current_epoch self.hard_sampling = hard_sampling.hard_sampling() print("model parameters: ") print(self.count_parameters(self.lane_detection_network))
''' Convert trained model into onnx. ''' import torch import torch.onnx from hourglass_network import lane_detection_network # (True)Convert to onnx mode. # (False)Check converted onnx model mode. convert = True save_dir = '/media/data4/yg/PINet_new-master/CurveLanes/onnx_models/' if convert == True: model = lane_detection_network() weights_path = '/media/data4/yg/PINet_new-master/CurveLanes/savefile/32_tensor(1.1001)_lane_detection_network.pkl' # Load the weights from a file (.pth or .pkl usually) state_dict = torch.load(weights_path) # Load the weights now into a model net architecture. model.load_state_dict(state_dict) # Create the right input shape. sample_batch_size = 1 channel = 3 height = 256 width = 512 dummy_input = torch.randn(sample_batch_size, channel, height, width)