You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`import cv2
import numpy as np
import onnxruntime as ort
import torch
import argparse
import os
import sys
sys.path.append(os.path.join(os.path.dirname(file), "../"))
from utils.config import Config
`import cv2
import numpy as np
import onnxruntime as ort
import torch
import argparse
import os
import sys
sys.path.append(os.path.join(os.path.dirname(file), "../"))
from utils.config import Config
class UFLDv2:
def init(self, onnx_path, config_path, ori_size):
self.session = ort.InferenceSession(onnx_path, providers=["CUDAExecutionProvider"])
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('--config_path', default='/home/akshat/Nidhin_wrkspace/Lane Detection/Ultra-Fast-Lane-Detection-v2/configs/tusimple_res18.py', help='path to config file', type=str)
parser.add_argument('--onnx_path', default='/home/akshat/Nidhin_wrkspace/Lane Detection/Ultra-Fast-Lane-Detection-v2/ufldv2_tusimple_res18_320x800.onnx', help='path to ONNX file', type=str)
parser.add_argument('--video_path', default='example.mp4', help='path to video file', type=str)
# parser.add_argument('--ori_size', default=(1600, 320), help='size of original frame', type=tuple)
parser.add_argument('--ori_size', default=(800, 320), help='size of original frame', type=tuple)
return parser.parse_args()
if name == "main":
args = get_args()
cap = cv2.VideoCapture(args.video_path)
isnet = UFLDv2(args.onnx_path, args.config_path, args.ori_size)
while True:
success, img = cap.read()
if not success:
print("Failed to read frame")
break
print(f"Image shape before resize: {img.shape}")
img = cv2.resize(img, (800, 451))
img = img[190:350, :, :]
isnet.forward(img)
if cv2.waitKey(25) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
`
Can anyone help me with the scaling issue I am facing...
The text was updated successfully, but these errors were encountered: