Fixed The AMD_GPU file to not import cuda and added the forgotton torch DML import (#63)

* Update main_onnx_amd.py

* Update main_onnx_amd.py
This commit is contained in:
Villageslayer 2023-03-27 06:07:28 +02:00 committed by GitHub
parent 8e6d0d3ac7
commit bc9af95607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
import onnxruntime as ort import onnxruntime as ort
import numpy as np import numpy as np
import cupy as cp
import pyautogui import pyautogui
import gc import gc
import numpy as np import numpy as np
@ -12,6 +11,7 @@ import pandas as pd
from utils.general import (cv2, non_max_suppression, xyxy2xywh) from utils.general import (cv2, non_max_suppression, xyxy2xywh)
import dxcam import dxcam
import torch import torch
import torch_directml
def main(): def main():
@ -109,7 +109,7 @@ def main():
npImg = npImg.astype(cp.half) npImg = npImg.astype(cp.half)
npImg = cp.moveaxis(npImg, 3, 1) npImg = cp.moveaxis(npImg, 3, 1)
outputs = ort_sess.run(None, {'images': cp.asnumpy(npImg)}) outputs = ort_sess.run(None, {'images': npImg})
im = torch.from_numpy(outputs[0]).to('cpu') im = torch.from_numpy(outputs[0]).to('cpu')