当前位置: 首页 > wzjs >正文

淄博网站建设服务wordpress英文模版

淄博网站建设服务,wordpress英文模版,网站制作服务平台,夫唯老师seo目录 一、直接下载python扩展 二、使用powershell配置版 问题:直接在终端使用conda命令不能执行 1.配置环境变量 2.修改脚本执行策略 3.验证修改有效性 三、附加内容 1.测试代码 2.预训练权重文件 3.一些数据集 一、直接下载python扩展 首先在应用拓展里…

目录

一、直接下载python扩展

二、使用powershell配置版

问题:直接在终端使用conda命令不能执行

1.配置环境变量

2.修改脚本执行策略

3.验证修改有效性

三、附加内容

1.测试代码

2.预训练权重文件

3.一些数据集


一、直接下载python扩展

首先在应用拓展里面下载python扩展

然后右下角选择解释器

然后无论是使用脚本运行还是编译器运行都可以了!

在使用此方法之前我是通过Cursor内的power shell进行配置的,中间报了一些错误,我把解决过程放在第二章节内,有兴趣的同学可以看看。

二、使用powershell配置版

问题:直接在终端使用conda命令不能执行

1.配置环境变量

首先需要把conda环境配置到环境变量Path内:

(这里写你自己conda环境存放的地址,这里地址只是做一个演示)

D:\miniconda3\ScriptsD:\miniconda3\condabin

此时可能会报错:

无法加载文件 C:\Users\Administrator\Documents\WindowsPowerShell\profile.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 ht tps:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。

那我们就需要修改一下系统设置:

2.修改脚本执行策略

还是在powershell终端,输入以下命令查看当前的执行策略:

Get-ExecutionPolicy

默认情况下,可能显示 Restricted

输入以下命令来允许执行本地脚本:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

这个命令会将执行策略设置为 RemoteSigned,即允许本地脚本运行,但会要求来自互联网的脚本必须有签名。

3.验证修改有效性

关闭 PowerShell 窗口并重新打开它,执行以下命令来查看执行策略是否已成功更改:

Get-ExecutionPolicy

然后执行:

conda init
conda activate yolotest

Conda 环境应该会被成功激活。

后记:此时运行python文件只能通过终端执行,cursor编译器还是不能直接点击运行按钮运行程序,所以直接省事选择上面下载python扩展即可!!!

三、附加内容

1.测试代码

from ultralytics import YOLO
from PIL import Image
import cv2
import os
import globdef predict_image(image_path, model_path='ultralytics/premodels/yolov8m.pt', output_dir='./output'):"""使用 YOLOv8 模型对单张图像进行预测参数:image_path (str): 输入图像的路径model_path (str): 模型权重文件的路径output_dir (str): 输出结果的目录"""# 确保输出目录存在os.makedirs(output_dir, exist_ok=True)# 加载预训练模型model = YOLO(model_path)# 预测图像results = model(image_path)# 获取预测结果for i, result in enumerate(results):# 获取图像文件名image_filename = os.path.basename(image_path)name, ext = os.path.splitext(image_filename)# 保存带标注的图像output_path = os.path.join(output_dir, f"{name}_pred{ext}")annotated_frame = result.plot()cv2.imwrite(output_path, cv2.cvtColor(annotated_frame, cv2.COLOR_RGB2BGR))print(f"预测结果已保存至: {output_path}")# 打印检测到的对象boxes = result.boxesprint(f"在图像中检测到 {len(boxes)} 个对象:")for box in boxes:class_id = int(box.cls)conf = float(box.conf)class_name = model.names[class_id]print(f"- {class_name} (置信度: {conf:.2f})")def predict_images(input_dir, model_path='ultralytics/premodels/yolov8m.pt', output_dir='./output'):"""使用 YOLOv8 模型对文件夹中的所有图像进行预测参数:input_dir (str): 输入图像文件夹的路径model_path (str): 模型权重文件的路径output_dir (str): 输出结果的目录"""# 支持的图像文件扩展名image_extensions = ['*.jpg', '*.jpeg', '*.png', '*.bmp']# 获取所有图像文件的路径image_paths = []for ext in image_extensions:image_paths.extend(glob.glob(os.path.join(input_dir, ext)))if not image_paths:print(f"在 {input_dir} 中未找到图像文件!")return# 处理每个图像for image_path in image_paths:try:print(f"\n正在处理: {image_path}")predict_image(image_path, model_path, output_dir)except Exception as e:print(f"处理图像 {image_path} 时出错: {str(e)}")if __name__ == "__main__":# 示例:预测单张图像# image_path = "ultralytics/assets/bus.jpg"  # 替换为你的图像路径# predict_image(image_path)# 示例:预测文件夹中的所有图像input_directory = "ultralytics/assets"  # 替换为你的图像文件夹路径predict_images(input_directory)

2.预训练权重文件

探索Ultralytics YOLOv8 -Ultralytics YOLO 文档

yolo项目下载地址:

https://github.com/ultralytics/ultralytics

3.一些数据集

  • COCO128:

Coco128 Dataset and Pre-Trained Model by Slava

  • DOTA Aerial Image

https://universe.roboflow.com/felipe-coradesque-6gmum/dota-aerial-images/dataset/3


文章转载自:

http://32nrqtL5.qcymf.cn
http://e0hAO8P8.qcymf.cn
http://cGgsNftQ.qcymf.cn
http://hlSBabC5.qcymf.cn
http://bi0MP7j9.qcymf.cn
http://IsGZ9o8B.qcymf.cn
http://TLjNBY2j.qcymf.cn
http://c3yKaeTw.qcymf.cn
http://24sRq86t.qcymf.cn
http://JrFu7OVz.qcymf.cn
http://6jS0SKre.qcymf.cn
http://jEeK6lWn.qcymf.cn
http://zXuKfau8.qcymf.cn
http://t1mMthDV.qcymf.cn
http://mtDs22QJ.qcymf.cn
http://JKKdJP1S.qcymf.cn
http://bmRKYBW0.qcymf.cn
http://4LQjnpCW.qcymf.cn
http://S83MMjrH.qcymf.cn
http://1O67Doiv.qcymf.cn
http://c55YyVhV.qcymf.cn
http://0wlrcD4n.qcymf.cn
http://YqMasgxg.qcymf.cn
http://3Fw1RNuZ.qcymf.cn
http://p05HJkeU.qcymf.cn
http://JYXLRmnK.qcymf.cn
http://gDPCS1DT.qcymf.cn
http://gwhU13HC.qcymf.cn
http://QiTgus3R.qcymf.cn
http://7Y4vjdjn.qcymf.cn
http://www.dtcms.com/wzjs/747023.html

相关文章:

  • 门户网站建设 存在的问题西安网站建设kxccc
  • 什么网站好建设wordpress秒开优化
  • 哈尔滨网站建设价格ps详情页模板
  • php在网站开发中的作用国外摄影网站推荐
  • 云南住房和城乡建设局网站上海沙龙网站建设
  • 移动网站建设是什么国外做测评的网站
  • 做外包的网站做二手平台公益的网站
  • 静海区网站建设推广动态二维码制作
  • 佛山网站搭建公司go网站开发
  • 涟水建设银行网站电子信息工程专业招聘信息网
  • 领手工在家做的网站2019泗水网站建设
  • 高端网站建设 aspx视频链接生成
  • 企业是做网站还是做微信展馆的科普网站建设
  • seo搜索引擎优化书籍湛江怎么做网站关键词优化
  • 网站录屏可以做证据吗在线解压zip网站
  • 关键词优化除了做网站还有什么方法光效网站
  • 免费推广网站有哪些有哪些怎么在网站做外部链接
  • 做网站需要下载啥南谯区住房和城乡建设局网站
  • 个人免费网站空间seo学徒是做什么
  • 镇江市住房和城乡建设局网站淘宝客 wordpress 主题
  • 网站推广如何做的电商数据统计网站
  • 网站备案怎么才能快速58直聘招聘网
  • 网站建设微信小程序开发python创建网页
  • 红酒营销 网站建设大连做网站那个公司最好
  • 中小学生做试卷的网站6门户网站建设课程设计
  • 时尚网站的建设策划男女做a视频网站
  • 青岛公路建设集团网站详情页设计多少钱
  • 品牌厂家网站建设呼和浩特网站建设
  • asp网站空间做付费网站好
  • 怎么做外网网站监控注册公司网站需要什么资料