简体   繁体   English

模块“sklearn.feature_extraction.image”没有属性“extract_patches”

[英]module 'sklearn.feature_extraction.image' has no attribute 'extract_patches'

for the code i have no idea about how to extract_patches with 3 positional对于代码,我不知道如何使用 3 个位置提取补丁

for filei in phases[phase]:
    fname=files[filei] 
    
    print(fname)
    classid=[idx for idx in range(len(class_names)) if class_names[idx] in fname][0]
    totals[classid]+=1

    io=cv2.cvtColor(cv2.imread(fname),cv2.COLOR_BGR2RGB)
    interp_method=PIL.Image.BICUBIC


    io = cv2.resize(io,(0,0),fx=resize,fy=resize, interpolation=interp_method) #resize it as specified above
    io = np.pad(io, [(mirror_pad_size, mirror_pad_size), (mirror_pad_size, mirror_pad_size), (0, 0)], mode="reflect")

    #convert input image into overlapping tiles, size is ntiler x ntilec x 1 x patch_size x patch_size x3
    io_arr_out=sklearn.feature_extraction.image.extract_patches(io,(patch_size,patch_size,3),stride_size)
   

    #resize it into a ntile x patch_size x patch_size x 3
    io_arr_out=io_arr_out.reshape(-1,patch_size,patch_size,3)



    storage["imgs"].append(io_arr_out)
    storage["labels"].append([classid for x in range(io_arr_out.shape[0])]) #add the filename to the storage array
    storage["filenames"].append([fname for x in range(io_arr_out.shape[0])]) #add the filename to the storage array

You can use patchify instead:您可以改用patchify

from patchify import patchify
io_arr_out = patchify(io, (patch_size,patch_size,3), step = stride_size )

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 创建映像补丁,sklearn.feature_extraction.image.extract_patches_2d内存错误 - Create image patches, sklearn.feature_extraction.image.extract_patches_2d memory error 如何解释sklearn.feature_extraction.image中img_to_graph的返回值? - How does one interpret the return value of img_to_graph in sklearn.feature_extraction.image? 模块“tsfresh.feature_extraction.feature_calculators”没有属性 - module 'tsfresh.feature_extraction.feature_calculators' has no attribute sklearn feature.Extraction'DictVectorizer'对象没有属性'feature_names_' - sklearn feature.Extraction 'DictVectorizer' object has no attribute 'feature_names_' ModuleNotFoundError:没有名为“sklearn.feature_extraction.dict_vectorizer”的模块 - ModuleNotFoundError: No module named 'sklearn.feature_extraction.dict_vectorizer' 模块 'matplotlib.pyplot' 没有属性 'patches' - module 'matplotlib.pyplot' has no attribute 'patches' 导入 sklearn 模块 sklearn 没有属性度量 - import sklearn module sklearn has no attribute metrics ImportError:没有名为 sklearn.feature_extraction.text 的模块 - ImportError: No module named sklearn.feature_extraction.text AttributeError:模块“librosa.filters”没有用于 PNCC 语音特征提取的属性“dct” - AttributeError: module 'librosa.filters' has no attribute 'dct' for PNCC speech feature extraction scikit-learn 的extract_patches 函数背后的理论/算法是什么? - What is the theory/algorithm behind extract_patches function of scikit-learn?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM