国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

fastdeploy快速部署yolov5離線模型

這篇具有很好參考價(jià)值的文章主要介紹了fastdeploy快速部署yolov5離線模型。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

本篇主要是介紹了yolov5模型的快速部署,使用過(guò)yolov5訓(xùn)練過(guò)的兄弟都知道,訓(xùn)練完之后,無(wú)論你的模型是如何導(dǎo)出的,最后想要使用導(dǎo)出的模型,可能還脫離不了yolov5框架,因?yàn)?,在使用?dǎo)出的模型前,yolov5對(duì)輸入層和輸出層都做了較多的圖像處理,導(dǎo)致,最后要么是調(diào)用yolov5中的detect.py,要么是自己手摳輸入層和輸出層的算法,這里,我順便講解一下后者

1、調(diào)用框架算法部署離線模型

先聲明一下,這里的算法并不是我本人摳出來(lái)的,是我的一個(gè)

好兄弟同事(王闊)

摳出來(lái)的,下面是由他認(rèn)真細(xì)致的研究代碼,最后總結(jié)出來(lái)的

import os
import time
from io import BytesIO
import torch
import torchvision
import re
import numpy as np
import cv2
from PIL import Image


def padded_resize(im, new_shape=(640, 640), stride=32):
    shape = im.shape[:2]

    r = min(new_shape[0] / shape[0], new_shape[1] / shape[1])
    new_unpad = int(round(shape[1] * r)), int(round(shape[0] * r))
    dw, dh = new_shape[1] - new_unpad[0], new_shape[0] - new_unpad[1]
    # dw, dh = np.mod(dw, stride), np.mod(dh, stride)
    dw /= 2
    dh /= 2
    if shape[::-1] != new_unpad:  # resize
        im = cv2.resize(im, new_unpad, interpolation=cv2.INTER_LINEAR)
    top, bottom = int(round(dh - 0.1)), int(round(dh + 0.1))
    left, right = int(round(dw - 0.1)), int(round(dw + 0.1))
    im = cv2.copyMakeBorder(im, top, bottom, left, right, cv2.BORDER_CONSTANT, value=(114, 114, 114))  # add border
    # Convert
    im = im.transpose((2, 0, 1))[::-1]  # HWC to CHW, BGR to RGB
    im = np.ascontiguousarray(im)
    im = torch.from_numpy(im)
    im = im.float()
    im /= 255
    im = im[None]
    im = im.cpu().numpy()  # torch to numpy
    return im


def xywh2xyxy(x):
    # Convert nx4 boxes from [x, y, w, h] to [x1, y1, x2, y2] where xy1=top-left, xy2=bottom-right
    y = x.clone() if isinstance(x, torch.Tensor) else np.copy(x)
    y[:, 0] = x[:, 0] - x[:, 2] / 2  # top left x
    y[:, 1] = x[:, 1] - x[:, 3] / 2  # top left y
    y[:, 2] = x[:, 0] + x[:, 2] / 2  # bottom right x
    y[:, 3] = x[:, 1] + x[:, 3] / 2  # bottom right y
    return y


def box_iou(box1, box2):
    """
    Return intersection-over-union (Jaccard index) of boxes.
    Both sets of boxes are expected to be in (x1, y1, x2, y2) format.
    Arguments:
        box1 (Tensor[N, 4])
        box2 (Tensor[M, 4])
    Returns:
        iou (Tensor[N, M]): the NxM matrix containing the pairwise
            IoU values for every element in boxes1 and boxes2
    """

    def box_area(box):
        # box = 4xn
        return (box[2] - box[0]) * (box[3] - box[1])

    area1 = box_area(box1.T)
    area2 = box_area(box2.T)

    # inter(N,M) = (rb(N,M,2) - lt(N,M,2)).clamp(0).prod(2)
    inter = (torch.min(box1[:, None, 2:], box2[:, 2:]) - torch.max(box1[:, None, :2], box2[:, :2])).clamp(0).prod(2)
    return inter / (area1[:, None] + area2 - inter)  # iou = inter / (area1 + area2 - inter)


def non_max_suppression(prediction, conf_thres=0.25, iou_thres=0.45, classes=None, agnostic=False, multi_label=False,
                        labels=(), max_det=300):
    """Runs Non-Maximum Suppression (NMS) on inference results

    Returns:
         list of detections, on (n,6) tensor per image [xyxy, conf, cls]
    """

    nc = prediction.shape[2] - 5  # number of classes
    xc = prediction[..., 4] > conf_thres  # candidates

    # Checks
    assert 0 <= conf_thres <= 1, f'Invalid Confidence threshold {conf_thres}, valid values are between 0.0 and 1.0'
    assert 0 <= iou_thres <= 1, f'Invalid IoU {iou_thres}, valid values are between 0.0 and 1.0'

    # Settings
    min_wh, max_wh = 2, 7680  # (pixels) minimum and maximum box width and height
    max_nms = 30000  # maximum number of boxes into torchvision.ops.nms()
    time_limit = 10.0  # seconds to quit after
    redundant = True  # require redundant detections
    multi_label &= nc > 1  # multiple labels per box (adds 0.5ms/img)
    merge = False  # use merge-NMS

    t = time.time()
    output = [torch.zeros((0, 6), device=prediction.device)] * prediction.shape[0]
    for xi, x in enumerate(prediction):  # image index, image inference
        # Apply constraints
        x[((x[..., 2:4] < min_wh) | (x[..., 2:4] > max_wh)).any(1), 4] = 0  # width-height
        x = x[xc[xi]]  # confidence

        # Cat apriori labels if autolabelling
        if labels and len(labels[xi]):
            lb = labels[xi]
            v = torch.zeros((len(lb), nc + 5), device=x.device)
            v[:, :4] = lb[:, 1:5]  # box
            v[:, 4] = 1.0  # conf
            v[range(len(lb)), lb[:, 0].long() + 5] = 1.0  # cls
            x = torch.cat((x, v), 0)

        # If none remain process next image
        if not x.shape[0]:
            continue

        # Compute conf
        x[:, 5:] *= x[:, 4:5]  # conf = obj_conf * cls_conf

        # Box (center x, center y, width, height) to (x1, y1, x2, y2)
        box = xywh2xyxy(x[:, :4])

        # Detections matrix nx6 (xyxy, conf, cls)
        if multi_label:
            i, j = (x[:, 5:] > conf_thres).nonzero(as_tuple=False).T
            x = torch.cat((box[i], x[i, j + 5, None], j[:, None].float()), 1)
        else:  # best class only
            conf, j = x[:, 5:].max(1, keepdim=True)
            x = torch.cat((box, conf, j.float()), 1)[conf.view(-1) > conf_thres]

        # Filter by class
        if classes is not None:
            x = x[(x[:, 5:6] == torch.tensor(classes, device=x.device)).any(1)]

        # Apply finite constraint
        # if not torch.isfinite(x).all():
        #     x = x[torch.isfinite(x).all(1)]

        # Check shape
        n = x.shape[0]  # number of boxes
        if not n:  # no boxes
            continue
        elif n > max_nms:  # excess boxes
            x = x[x[:, 4].argsort(descending=True)[:max_nms]]  # sort by confidence

        # Batched NMS
        c = x[:, 5:6] * (0 if agnostic else max_wh)  # classes
        boxes, scores = x[:, :4] + c, x[:, 4]  # boxes (offset by class), scores
        i = torchvision.ops.nms(boxes, scores, iou_thres)  # NMS
        if i.shape[0] > max_det:  # limit detections
            i = i[:max_det]
        if merge and (1 < n < 3E3):  # Merge NMS (boxes merged using weighted mean)
            # update boxes as boxes(i,4) = weights(i,n) * boxes(n,4)
            iou = box_iou(boxes[i], boxes) > iou_thres  # iou matrix
            weights = iou * scores[None]  # box weights
            x[i, :4] = torch.mm(weights, x[:, :4]).float() / weights.sum(1, keepdim=True)  # merged boxes
            if redundant:
                i = i[iou.sum(1) > 1]  # require redundancy

        output[xi] = x[i]
        if (time.time() - t) > time_limit:
            break  # time limit exceeded

    return output


def xyxy2xywh(x):
    # Convert nx4 boxes from [x1, y1, x2, y2] to [x, y, w, h] where xy1=top-left, xy2=bottom-right
    y = x.clone() if isinstance(x, torch.Tensor) else np.copy(x)
    y[:, 0] = (x[:, 0] + x[:, 2]) / 2  # x center
    y[:, 1] = (x[:, 1] + x[:, 3]) / 2  # y center
    y[:, 2] = x[:, 2] - x[:, 0]  # width
    y[:, 3] = x[:, 3] - x[:, 1]  # height
    return y


def is_ascii(s=''):
    # Is string composed of all ASCII (no UTF) characters? (note str().isascii() introduced in python 3.7)
    s = str(s)  # convert list, tuple, None, etc. to str
    return len(s.encode().decode('ascii', 'ignore')) == len(s)


def box_label(self, box, label='', color=(128, 128, 128), txt_color=(255, 255, 255)):
    # Add one xyxy box to image with label
    if self.pil or not is_ascii(label):
        self.draw.rectangle(box, width=self.lw, outline=color)  # box
        if label:
            w, h = self.font.getsize(label)  # text width, height
            outside = box[1] - h >= 0  # label fits outside box
            self.draw.rectangle((box[0],
                                 box[1] - h if outside else box[1],
                                 box[0] + w + 1,
                                 box[1] + 1 if outside else box[1] + h + 1), fill=color)
            # self.draw.text((box[0], box[1]), label, fill=txt_color, font=self.font, anchor='ls')  # for PIL>8.0
            self.draw.text((box[0], box[1] - h if outside else box[1]), label, fill=txt_color, font=self.font)
    else:  # cv2
        p1, p2 = (int(box[0]), int(box[1])), (int(box[2]), int(box[3]))
        cv2.rectangle(self.im, p1, p2, color, thickness=self.lw, lineType=cv2.LINE_AA)
        if label:
            tf = max(self.lw - 1, 1)  # font thickness
            w, h = cv2.getTextSize(label, 0, fontScale=self.lw / 3, thickness=tf)[0]  # text width, height
            outside = p1[1] - h - 3 >= 0  # label fits outside box
            p2 = p1[0] + w, p1[1] - h - 3 if outside else p1[1] + h + 3
            cv2.rectangle(self.im, p1, p2, color, -1, cv2.LINE_AA)  # filled
            cv2.putText(self.im, label, (p1[0], p1[1] - 2 if outside else p1[1] + h + 2), 0, self.lw / 3, txt_color,
                        thickness=tf, lineType=cv2.LINE_AA)


cls_labels = eval(open("./models/font_lib.txt", "r", encoding="utf8").read())


def return_coordinates(xyxy, conf, cls):
    conf = float(conf.numpy())
    gain = 1.02
    pad = 10
    xyxy = torch.tensor(xyxy).view(-1, 4)
    b = xyxy2xywh(xyxy)  # boxes
    b[:, 2:] = b[:, 2:] * gain + pad  # box wh * gain + pad
    xyxy = xywh2xyxy(b).long()
    c1, c2 = (int(xyxy[0, 0]) + 6, int(xyxy[0, 1]) + 6), (int(xyxy[0, 2]) - 6, int(xyxy[0, 3]) - 6)
    # print(f"leftTop:{c1},rightBottom:{c2},Confidence:{conf*100}%")
    cls = cls_labels[int(cls.numpy())]
    result_dict = {"leftTop": c1, "rightBottom": c2, "Confidence": conf, "Cls": cls}

    return result_dict


def clip_coords(boxes, shape):
    # Clip bounding xyxy bounding boxes to image shape (height, width)
    if isinstance(boxes, torch.Tensor):  # faster individually
        boxes[:, 0].clamp_(0, shape[1])  # x1
        boxes[:, 1].clamp_(0, shape[0])  # y1
        boxes[:, 2].clamp_(0, shape[1])  # x2
        boxes[:, 3].clamp_(0, shape[0])  # y2
    else:  # np.array (faster grouped)
        boxes[:, [0, 2]] = boxes[:, [0, 2]].clip(0, shape[1])  # x1, x2
        boxes[:, [1, 3]] = boxes[:, [1, 3]].clip(0, shape[0])  # y1, y2


def scale_coords(img1_shape, coords, img0_shape, ratio_pad=None):
    # Rescale coords (xyxy) from img1_shape to img0_shape
    if ratio_pad is None:  # calculate from img0_shape
        gain = min(img1_shape[0] / img0_shape[0], img1_shape[1] / img0_shape[1])  # gain  = old / new
        pad = (img1_shape[1] - img0_shape[1] * gain) / 2, (img1_shape[0] - img0_shape[0] * gain) / 2  # wh padding
    else:
        gain = ratio_pad[0][0]
        pad = ratio_pad[1]

    coords[:, [0, 2]] -= pad[0]  # x padding
    coords[:, [1, 3]] -= pad[1]  # y padding
    coords[:, :4] /= gain
    clip_coords(coords, img0_shape)
    return coords



這里的代碼大多都是框架里有的,兄弟們仔細(xì)找找就能發(fā)現(xiàn),上面的代碼包含輸入層的尺寸調(diào)整,輸出層的先驗(yàn)框判斷、坐標(biāo)類別輸出等等,那么將以上代碼加載保存后,按如下的代碼調(diào)用就能實(shí)現(xiàn)脫離整個(gè)yolov5框架,這里我以導(dǎo)出onnx模型距離

導(dǎo)出onnx模型

導(dǎo)出模型,可以參考yolov5,github官方導(dǎo)出鏈接:https://github.com/ultralytics/yolov5/issues/251
fastdeploy快速部署yolov5離線模型

python export.py --weights yolov5s.pt --include torchscript onnx
調(diào)用onnx模型

調(diào)用模型就很簡(jiǎn)單了,這里因?yàn)閷?dǎo)出的是onnx模型,所以加載模型自然也要用到onnxruntime這個(gè)庫(kù),至于這個(gè)庫(kù)的一些概念,兄弟們可以自行搜索,這里在讀取到onnx模型后,將預(yù)測(cè)結(jié)果通過(guò)非極大值抑制處理后,就能夠直接獲取到返回的坐標(biāo)了,如果有什么報(bào)錯(cuò)的話,直接私信博主也可以

import onnxruntime as ort

slider_model = ort.InferenceSession("slider.onnx", providers=['CPUExecutionProvider',])
pred = self.slider_model.run([self.slider_model.get_outputs()[0].name],
                          {self.slider_model.get_inputs()[0].name: im})[0]
pred = torch.tensor(pred)
pred = non_max_suppression(pred, conf_thres=0.60, iou_thres=0.60, max_det=1000)
coordinate_list = []
for i, det in enumerate(pred):
    det[:, :4] = scale_coords(im.shape[2:], det[:, :4], img.shape).round()
    for *xyxy, conf, cls in reversed(det):
        # 返回坐標(biāo)和置信度
        coordinates = return_coordinates(xyxy, conf, cls)
        coordinate_list.append(coordinates)

2、使用fastdeploy快速部署

之前講述了手摳yolov5中輸入層輸出層的算法來(lái)調(diào)用yolov5的模型,上面的代碼看似不多,但其實(shí)在手摳的過(guò)程中非常耗費(fèi)時(shí)間和精力,即使在摳出來(lái)后,調(diào)用也是一件比較麻煩的事,這里我就講述另一種方法,使用fastdeploy三行代碼就能部署yolov5模型

fast是由百度飛漿paddle發(fā)布的一個(gè)工具,官方鏈接https://github.com/PaddlePaddle/FastDeploy,采用fastdeploy部署模型有以下好處

  • 低門檻:一行命令下載SDK,一行命令即可體驗(yàn)部署Demo;不同硬件平臺(tái)一致的代碼體驗(yàn),降低基于業(yè)務(wù)模型和業(yè)務(wù)邏輯二次開(kāi)發(fā)難度;經(jīng)過(guò)官方驗(yàn)證,算法模型精度和推理魯棒性有保證。
  • 多場(chǎng)景:支持云、邊、端(包括移動(dòng)端)豐富軟硬件環(huán)境部署,支持圖像、視頻流、一鍵服務(wù)化等部署方式,滿足不同場(chǎng)景的AI部署訴求。
  • 多算法:支持圖像分類、目標(biāo)檢測(cè)、圖像分割、人臉檢測(cè)、人體關(guān)鍵點(diǎn)檢測(cè)、文本識(shí)別等30多個(gè)主流算法模型選型。

fastdeploy安裝依賴

  • CUDA >= 11.2 、cuDNN >= 8.0 、 Python >= 3.6
  • OS: Linux x86_64/macOS/Windows 10
gpu或者cpu安裝
pip install fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html
conda安裝
conda config --add channels conda-forge && conda install cudatoolkit=11.2 cudnn=8.2
僅cpu安裝
pip install fastdeploy-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html

那么話不多說(shuō),在安裝完之后,還是以上面導(dǎo)出的onnx模型舉例,這邊我們加載一張圖片,然后直接使用fastdeploy將預(yù)測(cè)出來(lái)的框畫(huà)出來(lái)

import cv2
import matplotlib.pyplot as plt
import os
import numpy as np


im = cv2.imread("test.png")
show_img = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
plt.imshow(show_img)
plt.pause(0.001)

fastdeploy快速部署yolov5離線模型
導(dǎo)入fastdeploy加載模型并返回預(yù)測(cè)結(jié)果和畫(huà)框

import fastdeploy as fd
model = fd.vision.detection.YOLOv5("runs/train/textclick_jiangxi3/weights/best.onnx")

result = model.predict(im)
for box in result.boxes:
    print(box)
    show_img = cv2.rectangle(show_img, (int(box[0]), int(box[1])), (int(box[2]), int(box[3])), (0, 0, 255), 2)
    
plt.imshow(show_img)
plt.pause(0.001)

fastdeploy快速部署yolov5離線模型
fastdeploy快速部署yolov5離線模型文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-486148.html

可以看到,使用fastdeploy非常的方便,不需要在里面添加任何的算法,僅僅幾行代碼就能將最后的預(yù)測(cè)結(jié)果和分類展示出來(lái)

到了這里,關(guān)于fastdeploy快速部署yolov5離線模型的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • yolov5 opencv dnn部署自己的模型

    yolov5 opencv dnn部署自己的模型

    github開(kāi)源代碼地址 yolov5官網(wǎng)還提供的dnn、tensorrt推理鏈接 本人使用的opencv c++ github代碼,代碼作者非本人,也是上面作者推薦的鏈接之一 如果想要嘗試直接運(yùn)行源碼中的yolo.cpp文件和yolov5s.pt推理sample.mp4,請(qǐng)參考這個(gè)鏈接的介紹 使用github源碼結(jié)合自己導(dǎo)出的onnx模型推理自己的

    2024年01月23日
    瀏覽(45)
  • flask后端進(jìn)行yolov5檢測(cè)模型的部署(填坑)

    flask后端進(jìn)行yolov5檢測(cè)模型的部署(填坑)

    麻痹的搞了我一整天,蛋疼 本來(lái)想把檢測(cè)模型或者rtsp實(shí)時(shí)流部署到后端。網(wǎng)上有人推薦一個(gè)github項(xiàng)目 https://github.com/muhk01/Yolov5-on-Flask 后來(lái)有人把這個(gè)項(xiàng)目給修改了,運(yùn)行起來(lái)了,我也準(zhǔn)備運(yùn)行一下 https://github.com/xugaoxiang/yolov5-flask ? 先把代碼拉下來(lái)直接配置: 先說(shuō)說(shuō)修改的

    2023年04月09日
    瀏覽(17)
  • C++模型部署:qt+yolov5/6+onnxruntime+opencv

    C++模型部署:qt+yolov5/6+onnxruntime+opencv

    作者平時(shí)主要是寫(xiě) c++ 庫(kù)的,界面方面了解不多,也沒(méi)有發(fā)現(xiàn)“美”的眼鏡,界面有點(diǎn)丑,大家多包涵。 本次介紹的項(xiàng)目主要是通過(guò) cmake 構(gòu)建一個(gè) 基于 c++ 語(yǔ)言的,以 qt 為框架的,包含 opencv 第三方庫(kù)在內(nèi)的,跨平臺(tái)的,使用 ONNX RUNTIME 進(jìn)行前向推理的 yolov5/6 演示平臺(tái)。文章

    2024年02月05日
    瀏覽(23)
  • 2022.09.29更新 c++下面部署yolov5實(shí)例分割模型(六)

    2022.09.29更新 c++下面部署yolov5實(shí)例分割模型(六)

    2023.01.11 更新: 新增加onnxruntime的1.13.x版本支持。 由于onnxruntime從1.12升級(jí)到1.13之后,GetOutputName()這個(gè)API變成了GetOutputNameAllocated(),坑就出現(xiàn)在這里,新版api的返回值是一個(gè)unique_ptr指針,這就意味著他使用一次時(shí)候就失效了,所以在循環(huán)跑模型的時(shí)候基本的第二次都報(bào)錯(cuò)

    2024年02月12日
    瀏覽(24)
  • YOLOV5(二):將pt轉(zhuǎn)為onnx模型并用opencv部署

    YOLOV5(二):將pt轉(zhuǎn)為onnx模型并用opencv部署

    yolov5s 6.0自帶export.py程序可將.pt轉(zhuǎn)為.onnx等,只需配置需要的環(huán)境即可。 1. 安裝環(huán)境 報(bào)錯(cuò):NVIDIA-tensorrt安裝失??! 解決:從源碼安裝TensorRt: ①安裝CUDNN和CudaToolKit等GPU配置 ②從官網(wǎng)下載需要的rt版本:https://developer.nvidia.com/nvidia-tensorrt-8x-download ③解壓后,將lib文件夾添加到

    2024年02月10日
    瀏覽(19)
  • Opencv C++實(shí)現(xiàn)yolov5部署onnx模型完成目標(biāo)檢測(cè)

    頭文件 命名空間 結(jié)構(gòu)體 Net_config 里面存了三個(gè)閾值和模型地址,其中 置信度 ,顧名思義,看檢測(cè)出來(lái)的物體的精準(zhǔn)度。以測(cè)量值為中心,在一定范圍內(nèi),真值出現(xiàn)在該范圍內(nèi)的幾率。 endsWith()函數(shù) 判斷sub是不是s的子串 anchors_640圖像接收數(shù)組 根據(jù)圖像大小,選擇相應(yīng)長(zhǎng)度的

    2024年02月13日
    瀏覽(24)
  • c++windows+yolov5-6.2+openvino模型部署超詳細(xì)

    c++windows+yolov5-6.2+openvino模型部署超詳細(xì)

    自我記錄:代碼是根據(jù)自己的項(xiàng)目需求,進(jìn)行了修改,主要是需要檢測(cè)的圖片非常大,目標(biāo)小,所以對(duì)圖片進(jìn)行了分割再檢測(cè)。下載完配置好環(huán)境之后可以直接跑。 我的環(huán)境是:windows+vs2019+openvino2022.2+opencv4.5.5+cmake3.14.0 步驟: 1、下載openvino,我用的版本是2022.2 官網(wǎng)網(wǎng)址:

    2024年02月11日
    瀏覽(19)
  • 模型實(shí)戰(zhàn)(11)之win10下Opencv+CUDA部署yolov5、yolov8算法

    模型實(shí)戰(zhàn)(11)之win10下Opencv+CUDA部署yolov5、yolov8算法

    測(cè)試環(huán)境:AMDRH7000+RTX3050+win10+vs2-10+opencv455+cuda11.7 關(guān)于opencv470+contrib+cuda的編譯,可以詳見(jiàn):Win10下Opencv+CUDA聯(lián)合編譯詳細(xì)教程 本文代碼同時(shí)支持 yolov5 、 yolov8 兩個(gè)模型,詳細(xì)過(guò)程將在文中給出, 完整代碼倉(cāng)庫(kù)最后給出 其中,yolov8在opencv-DNN + CUDA下的效果如下: 新建VS項(xiàng)目,名

    2024年02月16日
    瀏覽(20)
  • 【TensorRT】基于C#調(diào)用TensorRT 部署Yolov5模型 - 上篇:構(gòu)建TensorRTSharp

    【TensorRT】基于C#調(diào)用TensorRT 部署Yolov5模型 - 上篇:構(gòu)建TensorRTSharp

    ? NVIDIA TensorRT? 是用于高性能深度學(xué)習(xí)推理的 SDK,可為深度學(xué)習(xí)推理應(yīng)用提供低延遲和高吞吐量。詳細(xì)安裝方式參考以下博客: NVIDIA TensorRT 安裝 (Windows C++) ? 前文中已經(jīng)介紹了在C++中利用TensorRT 部署Yolov5模型,但在實(shí)際應(yīng)用中,經(jīng)常會(huì)出現(xiàn)在C#中部署模型的需求,目前T

    2023年04月24日
    瀏覽(20)
  • 【深度學(xué)習(xí)】YOLOv5實(shí)例分割 數(shù)據(jù)集制作、模型訓(xùn)練以及TensorRT部署

    【深度學(xué)習(xí)】YOLOv5實(shí)例分割 數(shù)據(jù)集制作、模型訓(xùn)練以及TensorRT部署

    yolov5-seg:官方地址:https://github.com/ultralytics/yolov5/tree/v6.2 TensorRT:8.x.x 語(yǔ)言:C++ 系統(tǒng):ubuntu18.04 前言:由于yolo倉(cāng)中提供了標(biāo)準(zhǔn)coco的json文件轉(zhuǎn)txt代碼,因此需要將labelme的json文件轉(zhuǎn)為coco json. labelme JSON 轉(zhuǎn)COCO JSON 使用labelme的CreatePolygons按鈕開(kāi)始繪制多邊形,然后保存為json格式。

    2024年02月06日
    瀏覽(26)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包