首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

 1.使用scikit-learn(GridSearchCV)进行网格搜索超参数调整(Python代码,包括数据集)

后端 52.98MB 6 需要积分: 1
立即下载

资源介绍:

在本教程中,您将学习如何使用该类GridSearchCV通过 scikit-learn 机器学习库进行网格搜索超参数调整。我们将网格搜索应用于计算机视觉项目。 我们将讨论: 1.什么是网格搜索 2.如何将网格搜索应用于超参数调整 3.scikit-learn 机器学习库如何通过网格搜索 从那里,我们将配置我们的开发环境并检查我们的项目目录结构。 然后,我将向您展示如何使用计算机视觉、机器学习和网格搜索超参数调整来将参数调整到纹理识别管道,从而产生一个接近 100% 纹理识别准确率的系统。
# USAGE # python train_model.py --dataset texture_dataset # import the necessary packages from pyimagesearch.localbinarypatterns import LocalBinaryPatterns from sklearn.model_selection import GridSearchCV from sklearn.metrics import classification_report from sklearn.svm import SVC from sklearn.model_selection import train_test_split from imutils import paths import argparse import time import cv2 import os # construct the argument parser and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-d", "--dataset", required=True, help="path to input dataset") args = vars(ap.parse_args()) # grab the image paths in the input dataset directory imagePaths = list(paths.list_images(args["dataset"])) # initialize the local binary patterns descriptor along with # the data and label lists print("[INFO] extracting features...") desc = LocalBinaryPatterns(24, 8) data = [] labels = [] # loop over the dataset of images for imagePath in imagePaths: # load the image, convert it to grayscale, and quantify it # using LBPs image = cv2.imread(imagePath) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) hist = desc.describe(gray) # extract the label from the image path, then update the # label and data lists labels.append(imagePath.split(os.path.sep)[-2]) data.append(hist) # partition the data into training and testing splits using 75% of # the data for training and the remaining 25% for testing print("[INFO] constructing training/testing split...") (trainX, testX, trainY, testY) = train_test_split(data, labels, random_state=22, test_size=0.25) # construct the set of hyperparameters to tune parameters = [ {"kernel": ["linear"], "C": [0.0001, 0.001, 0.1, 1, 10, 100, 1000]}, {"kernel": ["poly"], "degree": [2, 3, 4], "C": [0.0001, 0.001, 0.1, 1, 10, 100, 1000]}, {"kernel": ["rbf"], "gamma": ["auto", "scale"], "C": [0.0001, 0.001, 0.1, 1, 10, 100, 1000]} ] # tune the hyperparameters via a cross-validated grid search print("[INFO] tuning hyperparameters via grid search") grid = GridSearchCV(estimator=SVC(), param_grid=parameters, n_jobs=-1) start = time.time() grid.fit(trainX, trainY) end = time.time() # show the grid search information print("[INFO] grid search took {:.2f} seconds".format( end - start)) print("[INFO] grid search best score: {:.2f}%".format( grid.best_score_ * 100)) print("[INFO] grid search best parameters: {}".format( grid.best_params_)) # grab the best model and evaluate it print("[INFO] evaluating...") model = grid.best_estimator_ predictions = model.predict(testX) print(classification_report(testY, predictions))

资源文件列表:

1.hyperparameter-tuning-cv.zip 大约有99个文件
  1. hyperparameter-tuning-cv/
  2. hyperparameter-tuning-cv/pyimagesearch/
  3. hyperparameter-tuning-cv/train_model.py 2.55KB
  4. hyperparameter-tuning-cv/texture_dataset/
  5. hyperparameter-tuning-cv/texture_dataset/sand/
  6. hyperparameter-tuning-cv/texture_dataset/brick/
  7. hyperparameter-tuning-cv/texture_dataset/marble/
  8. hyperparameter-tuning-cv/pyimagesearch/__init__.py
  9. hyperparameter-tuning-cv/texture_dataset/sand/00000019.jpg 168.14KB
  10. hyperparameter-tuning-cv/texture_dataset/sand/00000006.jpg 1MB
  11. hyperparameter-tuning-cv/texture_dataset/sand/00000020.jpg 242.68KB
  12. hyperparameter-tuning-cv/texture_dataset/sand/00000023.jpg 47.42KB
  13. hyperparameter-tuning-cv/texture_dataset/sand/00000003.jpg 2.38MB
  14. hyperparameter-tuning-cv/texture_dataset/sand/00000010.jpg 249.86KB
  15. hyperparameter-tuning-cv/texture_dataset/sand/00000009.jpg 3.91MB
  16. hyperparameter-tuning-cv/texture_dataset/sand/00000033.jpg 3.25MB
  17. hyperparameter-tuning-cv/texture_dataset/sand/00000001.jpg 229.3KB
  18. hyperparameter-tuning-cv/texture_dataset/sand/00000032.jpg 102.42KB
  19. hyperparameter-tuning-cv/texture_dataset/sand/00000013.jpg 232.24KB
  20. hyperparameter-tuning-cv/texture_dataset/sand/00000018.jpg 60.75KB
  21. hyperparameter-tuning-cv/texture_dataset/sand/00000025.jpg 107.52KB
  22. hyperparameter-tuning-cv/texture_dataset/sand/00000012.jpg 119.29KB
  23. hyperparameter-tuning-cv/texture_dataset/sand/00000015.jpg 60.07KB
  24. hyperparameter-tuning-cv/texture_dataset/sand/00000016.jpg 177.74KB
  25. hyperparameter-tuning-cv/texture_dataset/sand/00000035.jpg 112.75KB
  26. hyperparameter-tuning-cv/texture_dataset/sand/00000007.jpg 112.6KB
  27. hyperparameter-tuning-cv/texture_dataset/sand/00000030.jpg 135.79KB
  28. hyperparameter-tuning-cv/texture_dataset/sand/00000011.jpg 60.34KB
  29. hyperparameter-tuning-cv/texture_dataset/sand/00000014.jpg 8.28MB
  30. hyperparameter-tuning-cv/texture_dataset/sand/00000034.jpg 563.85KB
  31. hyperparameter-tuning-cv/texture_dataset/sand/00000000.jpg 340.7KB
  32. hyperparameter-tuning-cv/texture_dataset/sand/00000029.jpg 912.82KB
  33. hyperparameter-tuning-cv/texture_dataset/sand/00000024.jpg 137.78KB
  34. hyperparameter-tuning-cv/texture_dataset/sand/00000021.jpg 293.16KB
  35. hyperparameter-tuning-cv/texture_dataset/sand/00000005.jpg 7.04MB
  36. hyperparameter-tuning-cv/texture_dataset/sand/00000028.jpg 3.24MB
  37. hyperparameter-tuning-cv/texture_dataset/sand/00000026.jpg 245.84KB
  38. hyperparameter-tuning-cv/texture_dataset/sand/00000004.jpg 334.93KB
  39. hyperparameter-tuning-cv/texture_dataset/brick/00000025.jpg 137.75KB
  40. hyperparameter-tuning-cv/texture_dataset/brick/00000005.jpg 132.02KB
  41. hyperparameter-tuning-cv/texture_dataset/brick/00000002.jpg 355.66KB
  42. hyperparameter-tuning-cv/texture_dataset/brick/00000035.jpg 28.95KB
  43. hyperparameter-tuning-cv/texture_dataset/brick/00000006.jpg 67.68KB
  44. hyperparameter-tuning-cv/texture_dataset/brick/00000016.jpg 243.44KB
  45. hyperparameter-tuning-cv/texture_dataset/brick/00000022.jpg 204.52KB
  46. hyperparameter-tuning-cv/texture_dataset/brick/00000033.jpg 204.73KB
  47. hyperparameter-tuning-cv/texture_dataset/brick/00000038.jpg 35.82KB
  48. hyperparameter-tuning-cv/texture_dataset/brick/00000001.jpg 180.65KB
  49. hyperparameter-tuning-cv/texture_dataset/brick/00000009.jpg 76.15KB
  50. hyperparameter-tuning-cv/texture_dataset/brick/00000037.jpg 47.22KB
  51. hyperparameter-tuning-cv/texture_dataset/brick/00000013.jpg 291.15KB
  52. hyperparameter-tuning-cv/texture_dataset/brick/00000020.jpg 150.57KB
  53. hyperparameter-tuning-cv/texture_dataset/brick/00000015.jpg 131.58KB
  54. hyperparameter-tuning-cv/texture_dataset/brick/00000023.jpg 1.51MB
  55. hyperparameter-tuning-cv/texture_dataset/brick/00000027.jpg 75.31KB
  56. hyperparameter-tuning-cv/texture_dataset/brick/00000011.jpg 854.4KB
  57. hyperparameter-tuning-cv/texture_dataset/brick/00000019.jpg 2.65MB
  58. hyperparameter-tuning-cv/texture_dataset/brick/00000012.jpg 1.96MB
  59. hyperparameter-tuning-cv/texture_dataset/brick/00000029.jpg 18.89KB
  60. hyperparameter-tuning-cv/texture_dataset/brick/00000032.jpg 98.84KB
  61. hyperparameter-tuning-cv/texture_dataset/brick/00000040.jpg 194.06KB
  62. hyperparameter-tuning-cv/texture_dataset/brick/00000017.jpg 239.46KB
  63. hyperparameter-tuning-cv/texture_dataset/brick/00000021.jpg 90.83KB
  64. hyperparameter-tuning-cv/texture_dataset/brick/00000008.jpg 1.55MB
  65. hyperparameter-tuning-cv/texture_dataset/brick/00000000.jpg 1.2MB
  66. hyperparameter-tuning-cv/texture_dataset/brick/00000030.jpg 63.51KB
  67. hyperparameter-tuning-cv/texture_dataset/brick/00000007.jpg 808.26KB
  68. hyperparameter-tuning-cv/texture_dataset/brick/00000014.jpg 236.8KB
  69. hyperparameter-tuning-cv/texture_dataset/marble/00000026.jpg 29.19KB
  70. hyperparameter-tuning-cv/texture_dataset/marble/00000029.jpg 64.53KB
  71. hyperparameter-tuning-cv/texture_dataset/marble/00000002.jpg 83.8KB
  72. hyperparameter-tuning-cv/texture_dataset/marble/00000012.jpg 9.49KB
  73. hyperparameter-tuning-cv/texture_dataset/marble/00000037.jpg 55.13KB
  74. hyperparameter-tuning-cv/texture_dataset/marble/00000009.jpg 25.73KB
  75. hyperparameter-tuning-cv/texture_dataset/marble/00000001.jpg 24.07KB
  76. hyperparameter-tuning-cv/texture_dataset/marble/00000040.jpg 11.69KB
  77. hyperparameter-tuning-cv/texture_dataset/marble/00000043.jpg 19.23KB
  78. hyperparameter-tuning-cv/texture_dataset/marble/00000038.jpg 83.67KB
  79. hyperparameter-tuning-cv/texture_dataset/marble/00000007.jpg 174.38KB
  80. hyperparameter-tuning-cv/texture_dataset/marble/00000005.jpg 40.22KB
  81. hyperparameter-tuning-cv/texture_dataset/marble/00000016.jpg 92.63KB
  82. hyperparameter-tuning-cv/texture_dataset/marble/00000008.jpg 35.1KB
  83. hyperparameter-tuning-cv/texture_dataset/marble/00000004.jpg 13.54KB
  84. hyperparameter-tuning-cv/texture_dataset/marble/00000034.jpg 8.33KB
  85. hyperparameter-tuning-cv/texture_dataset/marble/00000018.jpg 95.76KB
  86. hyperparameter-tuning-cv/texture_dataset/marble/00000010.jpg 33.57KB
  87. hyperparameter-tuning-cv/texture_dataset/marble/00000031.jpg 38.93KB
  88. hyperparameter-tuning-cv/texture_dataset/marble/00000039.jpg 109.3KB
  89. hyperparameter-tuning-cv/texture_dataset/marble/00000006.jpg 30.87KB
  90. hyperparameter-tuning-cv/texture_dataset/marble/00000003.jpg 733.67KB
  91. hyperparameter-tuning-cv/texture_dataset/marble/00000030.jpg 2.19MB
  92. hyperparameter-tuning-cv/texture_dataset/marble/00000022.jpg 306.87KB
  93. hyperparameter-tuning-cv/texture_dataset/marble/00000027.jpg 13.22KB
  94. hyperparameter-tuning-cv/texture_dataset/marble/00000021.jpg 34.57KB
  95. hyperparameter-tuning-cv/texture_dataset/marble/00000014.jpg 848.03KB
  96. hyperparameter-tuning-cv/texture_dataset/marble/00000000.jpg 28.52KB
  97. hyperparameter-tuning-cv/texture_dataset/marble/00000020.jpg 14.63KB
  98. hyperparameter-tuning-cv/texture_dataset/marble/00000044.jpg 22.01KB
  99. hyperparameter-tuning-cv/pyimagesearch/localbinarypatterns.py 787B
0评论
提交 加载更多评论
其他资源 2.使用scikit-learn和Python进行超参数调整(Python代码,包括数据集)
在本教程中,您将学习如何使用 scikit-learn 和 Python 调整模型超参数。 我们将从讨论什么是超参数调整以及它为什么如此重要来开始本教程。 从那里,我们将配置您的开发环境并检查项目目录结构。 然后我们将执行三个 Python 脚本: 1.无需调整超参数即可训练模型(这样我们就可以获得基线) 2.一种是利用一种称为“网格搜索”的算法来详尽检查所有超参数组合的方法——这种方法保证对超参数值进行全面扫描,但速度也很慢 3.最后一种方法是使用“随机搜索”,从分布中抽取各种超参数(不能保证覆盖所有超参数值,但在实践中通常与网格搜索一样准确,而且运行速度更快)
CSDN新客户端.zip
CSDN新客户端.zip
stylus-1.5.51.zip
Stylus是一款能改变网站样式的样式管理器
基于协同过滤算法的小说推荐系统的设计与实现.zip
基于协同过滤算法的小说推荐系统的设计与实现+源代码+文档说明+PPT(毕业设计),本资源中的源码都是经过本地编译过可运行的,通过毕业答辩得分90以上。 基于协同过滤算法的小说推荐系统的设计与实现+源代码+文档说明+PPT(毕业设计) 基于协同过滤算法的小说推荐系统的设计与实现+源代码+文档说明+PPT(毕业设计) 基于协同过滤算法的小说推荐系统的设计与实现+源代码+文档说明+PPT(毕业设计) 基于协同过滤算法的小说推荐系统的设计与实现+源代码+文档说明+PPT(毕业设计)基于协同过滤算法的小说推荐系统的设计与实现+源代码+文档说明+PPT(毕业设计)基于协同过滤算法的小说推荐系统的设计与实现+源代码+文档说明+PPT(毕业设计)基于协同过滤算法的小说推荐系统的设计与实现+源代码+文档说明+PPT(毕业设计)基于协同过滤算法的小说推荐系统的设计与实现+源代码+文档说明+PPT(毕业设计)基于协同过滤算法的小说推荐系统的设计与实现+源代码+文档说明+PPT(毕业设计)基于协同过滤算法的小说推荐系统的设计与实现+源代码+文档说明+PPT(毕业设计)基于协同过滤算法的小说推荐系统的设计
基于协同过滤算法的小说推荐系统的设计与实现.zip 基于协同过滤算法的小说推荐系统的设计与实现.zip 基于协同过滤算法的小说推荐系统的设计与实现.zip
免费源码小插件-查询网站备案代码.zip
最近在开发一个插件,其中有个很重要的功能就是查询对象网站是否备案。我在网上找了一圈,发现好多能实现这个功能的接口都是要收费的。咱就是说,能不花钱就不花钱,本着能省尽省的原则,我开始努力地寻找免费的接口。 还真别说,经过一番折腾,我找到了几个还算不错的免费接口。我把这几个接口整合到一起,采用随机匹配的方式。这样一来,如果一个接口失效了,就会自动切换到下一个接口,一直到成功查询出结果为止。虽然过程有点曲折,但总算是解决了这个问题,下面我把代码放出,有需要的自取吧 ————————————————
Arduino-INA226-程序
Arduino-INA226-程序
【Babylon提升】加载wms瓦片地图
【Babylon提升】加载wms瓦片地图
Marvell SWdownloader 4.8.8.2
Marvell固件下载工具