码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 【目标检测】基于深度学习的植物中草药智能识别系统【python源码+Pyqt5界面+数据集+训练代码 MX_001期】


    系统简介:

    这是一款基于深度学习技术的植物草药智能识别系统。系统通过分析植物草药的图像,能够准确地识别出不同种类的草药,并提供相关的信息和用途。用户只需将植物草药的图像上传至系统,即可快速获得识别结果。

    系统利用先进的深度学习算法,对植物草药图像进行特征提取和模式识别,从而实现高精度的分类和识别。同时系统具备良好的用户界面和友好的交互体验,使得用户能够轻松使用并获得所需的识别结果。

    系统界面:

    部分代码(完整代码在最后):

    1. def main(img_path):
    2. import os
    3. os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'
    4. device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
    5. img_size = 224
    6. data_transform = transforms.Compose(
    7. [transforms.Resize(int(img_size * 1.143)),
    8. transforms.CenterCrop(img_size),
    9. transforms.ToTensor(),
    10. transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])
    11. assert os.path.exists(img_path), "file: '{}' dose not exist.".format(img_path)
    12. img = Image.open(img_path)
    13. plt.imshow(img)
    14. img = data_transform(img)
    15. img = torch.unsqueeze(img, dim=0)
    16. json_path = './class_indices.json'
    17. assert os.path.exists(json_path), "file: '{}' dose not exist.".format(json_path)
    18. json_file = open(json_path, "r")
    19. class_indict = json.load(json_file)
    20. # create model
    21. model = create_model(num_classes=67).to(device)
    22. # load model weights
    23. model_weight_path = "model-90.pth"
    24. model.load_state_dict(torch.load(model_weight_path, map_location=device))
    25. model.eval()
    26. with torch.no_grad():
    27. # predict class
    28. output = torch.squeeze(model(img.to(device))).cpu()
    29. predict = torch.softmax(output, dim=0)
    30. predict_cla = torch.argmax(predict).numpy()
    31. for i in range(len(predict)):
    32. print("class: {:10} prob: {:.3}".format(class_indict[str(i)],
    33. predict[i].numpy()))
    34. # plt.show()
    35. res = class_indict[str(list(predict.numpy()).index(max(predict.numpy())))]
    36. num= "%.2f" % (max(predict.numpy()) * 100) + "%"
    37. print(res,num)
    38. return res,max(predict.numpy())

    完整源码:【目标检测】基于深度学习的植物中草药智能识别系统【python源码+Pyqt5界面+数据集+训练代码】

  • 相关阅读:
    【学习】科大睿智解读ITSS通过后仍需关注和改进IT服务的原因
    SpringMVC系列(六)之JSON数据返回以及异常处理机制
    MFC使用友元函数访问窗体类成员变量
    目标跟踪评估绘图(3):ubuntu18.04在MATLAB2016b下的vot-toolkit配置,绘制VOT数据集的EAO评估图,与其他算法进行比较
    苹果ios企业签名永不掉签免签网页封装应用解决方案
    html实现爱情浪漫表白甜蜜时刻(附源码)
    架构师系列- 定时任务(一)- 单机和分布式定时任务比较
    60主从复制,哨兵模式,集群
    使用beef劫持用户浏览器
    深拷贝和浅拷贝
  • 原文地址:https://blog.csdn.net/ANDROID6666666/article/details/139335426
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号