本文整理匯總了Python中joblib.Parallel.astype方法的典型用法代碼示例。如果您正苦於以下問題:Python Parallel.astype方法的具體用法?Python Parallel.astype怎麽用?Python Parallel.astype使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類joblib.Parallel
的用法示例。
在下文中一共展示了Parallel.astype方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: extract_all_class_features
# 需要導入模塊: from joblib import Parallel [as 別名]
# 或者: from joblib.Parallel import astype [as 別名]
def extract_all_class_features(dataset, n_jobs=1, stride=5, patch_size=10):
"""Extract masked features from all dataset images, return features and labels"""
cns = []
labels = []
for (label, cls) in enumerate(dataset.classes):
print 'Extracting masked CNs from class {}'.format(cls)
hists = Parallel(n_jobs=n_jobs)(delayed(extract_masked_cns)(imname, maskname) for (imname, maskname) in dataset.get_class_images(cls))
hists = np.vstack(hists)
labels.append(label * np.ones((len(hists),), dtype=np.float32))
cns.append(hists.astype(np.float32))
# Stack lists in numpy arrays.
return (cns, labels)