yolov5交互式界面 V5.0-6.0版本通用界面-yolo-pyqt-gui(通用界面制作+代码)

news/2024/7/10 23:05:19 标签: YOLO, pyqt, GUI, ui, 交互式界面, 通用界面

往期热门博客项目回顾:

计算机视觉项目大集合

改进的yolo目标检测-测距测速

路径规划算法

图像去雨去雾+目标检测+测距项目

交通标志识别项目

yolo系列-重磅yolov9界面-最新的yolo

姿态识别-3d姿态识别

深度学习小白学习路线

GUI_OYQT_24">yolo GUI OYQT界面

YOLOv5-GUI是一款专为YOLOv5(包括版本5和版本6)目标检测算法设计开发的图形用户界面(GUI)工具,采用强大的Qt框架构建。该工具汲取了Javacr大神在UI设计与逻辑方面的精华理念,旨在为广大用户提供更为直观、便捷且高效的YOLOv5模型训练、测试和应用体验。
在这里插入图片描述

  • YOLOv5-GUI拥有深色和浅色两种主题风格供用户自由选择,满足不同场景下的视觉需求。深色模式有助于降低长时间使用电脑时的眼部疲劳,而浅色模式则适合在各种光照条件下保持清晰舒适的视觉效果。
  • GUI工具集成了YOLOv5的核心功能,包括但不限于模型加载、参数配置、数据集管理、训练过程可视化监控、实时视频目标检测以及结果展示等环节。用户无需通过命令行操作,只需通过点击和拖拽等方式即可完成复杂的深度学习任务,极大降低了YOLOv5的使用门槛。
  • 在实际应用中,YOLOv5-GUI能够帮助科研人员、开发者以及广大AI爱好者更高效地利用YOLOv5算法进行目标检测项目的研究与实践,无论是对已有的公开数据集进行模型训练优化,还是针对特定场景定制目标检测解决方案,都能轻松应对。

代码使用

切换到项目目录:

bash
cd [PyQt5-YOLOv5_V5/PyQt5-YOLOv5_V6]

接下来,安装所需的环境依赖:

bash
pip install -r requirements.txt

现在,你可以启动应用程序:

bash
python run.py

GUI应用程序默认采用深色模式,但如果你想切换到浅色模式,只需在run.py文件中将main_ui_dark修改为main_ui_light即可。

  • 这个GUI应用程序提供了许多功能和选项,可以帮助你使用YOLOv5更加方便和高效。你可以在界面上进行图像处理、对象检测等操作。另外,你也可以根据自己的需求对代码进行定制和扩展。
  • 总的来说,这个项目为使用YOLOv5提供了一个直观和友好的界面,使得用户能够更轻松地利用这一强大的目标检测工具。希望你能享受使用这个GUI应用程序,并从中获得更多的收获和乐趣!

重要代码

 def run(self,
            imgsz=640,  # inference size (pixels)
            iou_thres=0.45,  # NMS IOU threshold
            max_det=1000,  # maximum detections per image
            device='',  # cuda device, i.e. 0 or 0,1,2,3 or cpu
            view_img=True,  # show results
            save_txt=False,  # save results to *.txt
            save_conf=False,  # save confidences in --save-txt labels
            save_crop=False,  # save cropped prediction boxes
            nosave=False,  # do not save images/videos
            classes=None,  # filter by class: --class 0, or --class 0 2 3
            agnostic_nms=False,  # class-agnostic NMS
            augment=False,  # augmented inference
            visualize=False,  # visualize features
            update=False,  # update all models
            project='runs/detect',  # save results to project/name
            name='exp',  # save results to project/name
            exist_ok=False,  # existing project/name ok, do not increment
            line_thickness=3,  # bounding box thickness (pixels)
            hide_labels=False,  # hide labels
            hide_conf=False,  # hide confidences
            half=False,  # use FP16 half-precision inference
            dnn=False,  # use OpenCV DNN for ONNX inference
            ):

        # Initialize
        device = select_device(device)
        half &= device.type != 'cpu'  # half precision only supported on CUDA

        # Load model
        model = DetectMultiBackend(self.weights, device=device, dnn=dnn)
        num_params = 0
        for param in model.parameters():
            num_params += param.numel()
        stride, names, pt, jit, onnx, engine = model.stride, model.names, model.pt, model.jit, model.onnx, model.engine
        imgsz = check_img_size(imgsz, s=stride)  # check image size
        names = model.module.names if hasattr(model, 'module') else model.names  # get class names
        if half:
            model.half()  # to FP16

        # Dataloader
        if self.source.isnumeric():
            view_img = check_imshow()
            cudnn.benchmark = True  # set True to speed up constant image size inference
            dataset = LoadStreams(self.source, img_size=imgsz, stride=stride, auto=pt and not jit)
            bs = len(dataset)  # batch_size
        else:
            dataset = LoadImages(self.source, img_size=imgsz, stride=stride, auto=pt and not jit)
            bs = 1  # batch_size
        vid_path, vid_writer = [None] * bs, [None] * bs

        # Run inference
        # model.warmup(imgsz=(1, 3, *imgsz), half=half)  # warmup
        dt, seen = [0.0, 0.0, 0.0], 0
        for path, im, im0s, self.vid_cap, s in dataset:
            statistic_dic = {name: 0 for name in names}
            t1 = time_sync()
            im = torch.from_numpy(im).to(device)
            im = im.half() if half else im.float()  # uint8 to fp16/32
            im /= 255  # 0 - 255 to 0.0 - 1.0
            if len(im.shape) == 3:
                im = im[None]  # expand for batch dim
            t2 = time_sync()
            dt[0] += t2 - t1

            # Inference
            pred = model(im, augment=augment)
            t3 = time_sync()
            dt[1] += t3 - t2

            # NMS
            pred = non_max_suppression(pred, self.conf_thres, iou_thres, classes, agnostic_nms, max_det=max_det)
            dt[2] += time_sync() - t3

            for i, det in enumerate(pred):  # detections per image
                im0 = im0s.copy()
                annotator = Annotator(im0, line_width=line_thickness, example=str(names))
                if len(det):
                    det[:, :4] = scale_coords(im.shape[2:], det[:, :4], im0.shape).round()
                    for c in det[:, -1].unique():
                        n = (det[:, -1] == c).sum()  # detections per class
                        s += f"{n} {names[int(c)]}{'s' * (n > 1)}, "  # add to string

                    for *xyxy, conf, cls in reversed(det):
                        c = int(cls)  # integer class
                        statistic_dic[names[c]] += 1
                        label = None if hide_labels else (names[c] if hide_conf else f'{names[c]} {conf:.2f}')
                        annotator.box_label(xyxy, label, color=colors(c, True))


            time.sleep(1/40)
            # print(type(im0s))
            self.send_img.emit(im0)
            self.send_raw.emit(im0s if isinstance(im0s, np.ndarray) else im0s[0])
            self.send_statistic.emit(statistic_dic)

最后:计算机视觉、图像处理、毕业辅导、作业帮助、代码获取,远程协助,代码定制,私聊会回复!

#code全部代码:qq1309399183


http://www.niftyadmin.cn/n/5450579.html

相关文章

c语音函数大全(R开头)

c语音函数大全(R开头) There is no nutrition in the blog content. After reading it, you will not only suffer from malnutrition, but also impotence. The blog content is all parallel goods. Those who are worried about being cheated should leave quickly. 函数名…

【设计模式】工厂方法模式详解

在java中,万物皆对象,这些对象都需要创建,如果创建的时候直接new该对象,就会对该对象耦合严重,假如我们要更换对象,所有new对象的地方都需要修改一遍,这显然违背了软件设计的开闭原则。如果我们…

探索 PostgreSQL 的外部数据包装器和统计函数

Navicat for PostgreSQL 因其稳定性和可扩展性而广受青睐,为开发人员和数据管理员提供了许多有用的函数。在这些函数中,file_fdw_handler、file_fdw_validator、pg_stat_statements、pg_stat_statements_info 以及 pg_stat_statements_reset 是其中的重要…

Mysql数据库:日志管理、备份与恢复

目录 前言 一、MySQL日志管理 1、存放日志和数据文件的目录 2、日志的分类 2.1 错误日志 2.2 通用查询日志 2.3 二进制日志 2.4 慢查询日志 2.5 中继日志 3、日志综合配置 4、查询日志是否开启 二、数据备份概述 1、数据备份的重要性 2、备份类型 2.1 从物理与…

零基础入门多媒体音频(5)-alsa(1)

alsa是音频最重要的框架,没有之一。接下来一个月时间在总结工作知识的主线上。单开个音频支线讲解alsa。说实话,alsa这块我也不是很精通。只在过去的项目中增加 一路substream实现低延时。我打算从下面四个方面去学习alsa。 1.alsa官网。网址如下&#x…

SQLite3 数据库的基本操作

SQLite3 是一种轻量级的关系型数据库管理系统,常用于移动设备和小型应用程序中。下面是一些使用 SQLite3 数据库的基本操作: 连接到数据库:使用命令 0 来连接到一个 SQLite3 数据库文件,如果该文件不存在则会创建一个新的数据库文…

Java后端设置服务器允许跨域

文章目录 1、实现2、一些问题关于各项请求头的作用关于预检请求 3、一些补充4、疑问点 1、实现 以下通过servlet的Filter给所有响应的header加了一些跨域相关的数据,以实现允许跨域。 import org.springframework.context.annotation.Configuration; import org.s…

前端Ajax请求从后端获取二进制文件并下载

大家都知道前端的下载除了最简单的a标签href,还有时候需要验证token,此时后台会给一个返回二进制的下载接口。如果你用ajax普通的get,post请求,接口会返回乱码。那么本文就带你封装一个处理二进制下载的方法。 1.设置responseTyp…