首页下载资源后端 1.使用scikit-learn(GridSearchCV)进行网格搜索超参数调整(Python代码,包括数据集)

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

weixin_4327139952.98MB需要积分:1

资源文件列表:

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

资源介绍:

在本教程中,您将学习如何使用该类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))
100+评论
captcha