相关试题
多选题 【多选】
GrabCut图像分割算法作为一种交互式分割算法,它可以采用以下哪两种方式实现图像分割?【选两个opencv库的常量参数】
多选题 【多选】
图像处理中,以下滤波器属于线性滤波器是?【高期模糊滤波器, 盒式滤波器(均值滤波器)】
单选题 【单选】
在下列代码中,基于MNIST手写数字训练集(train_data、train_labels)和测试集(test_data、test_labels),使用scikit-learn库中的KNN最近邻分类器进行图像分类,非常关键的一步是基于训练集构建球树数据结构对象,请将下面缺失的代码补充完整?【BallTree(train_data)】
Import time
From sklearn.neighbors import BallTree
Import pandas as pd
Import seaborn as sn
From sklearn import metrics
T_before = time.time()
Ball_tree = ____________________________
T_after = time.time()
T_training = t_after - t_before
T_before = time.time()
Test_neighbors = np.squeeze(ball_tree.query(test_data, k=1,return_distance=False))
Test_predictions = train_labels[test_neighbors]
T_after = time.time()
T_testing = t_after - t_before
T_accuracy = sum(test_predictions == test_labels) / float(len(test_labels))
Cm = metrics.confusion_matrix(test_labels,test_predictions)
Df_cm = pd.DataFrame(cm, range(10), range(10))
Sn.set(font_scale=1.2)#for label size
Sn.heatmap(df_cm, annot=True,annot_kws={"size": 16}, fmt="g")
单选题 【单选】
下列代码中,采用PCA主成分分析算法,基于AT&T公司的fetch_olivetti_faces人脸数据集,实现人脸重建,请问其中的faces变量数据类型是什么?【Dictionary】
From sklearn.preprocessing import StandardScaler
From sklearn.decomposition import PCA
From sklearn.pipeline import Pipeline
From sklearn.datasets import fetch_olivetti_faces
Faces = fetch_olivetti_faces().data
N_comp =64
Pipeline = Pipeline([('scaling', StandardScaler()), ('pca',PCA(n_components=n_comp))])
Faces_proj = pipeline.fit_transform(faces)
Mean_face = np.reshape(pipeline.named_steps['scaling'].mean_, (64,64))
Sd_face = np.reshape(np.sqrt(pipeline.named_steps['scaling'].var_),(64,64))
Eigen_face =np.reshape(faces_proj[0,:]@pipeline.named_steps['pca'].components_,(64,64))
#人脸重建
Reconst_face = mean_face + sd_face*eigen_face
Orig_face = np.reshape(faces[0,:], (64,64))
Plt.figure(figsize=(10,5))
Plt.subplot(121), plt.imshow(orig_face, cmap=plt.cm.bone,
Interpolation='nearest'), plt.axis('off'), plt.title('原始人脸', size=20)
Plt.subplot(122), plt.imshow(reconst_face, cmap=plt.cm.bone,
Interpolation='nearest'), plt.axis('off'), plt.title('重建后的人脸',size=20)
Plt.show()
单选题 【单选】
请从选项中选择正确的一项,用于补充下列缺失的代码行:【remove_small_objects(fill_coins, 21)】
#基于边缘的图像分割
From scipy import ndimage as ndi
From skimage.morphology import remove_small_objects
From skimage import data
Coins = data.coins()
#1.canny滤波器进行边缘检测
Edges = canny(coins, sigma=1)
Fig, axes = pylab.subplots(figsize=(10, 6))
Axes.imshow(edges, cmap=pylab.cm.gray, interpolation='nearest')
Axes.set_title('Canny边缘检测'), axes.axis('off'), pylab.show()
#2.填充二值图像孔洞
Fill_coins = ndi.binary_fill_holes(edges)
Fig, axes = pylab.subplots(figsize=(10, 6))
Axes.imshow(fill_coins, cmap=pylab.cm.gray, interpolation='nearest')
Axes.set_title('填充孔洞'), axes.axis('off'), pylab.show()
#3.删除未被填充的小对象
Coins_cleaned = ________________________________
Fig, axes = pylab.subplots(figsize=(10, 6))
Axes.imshow(coins_cleaned, cmap=pylab.cm.gray, interpolation='nearest')
Axes.set_title('删除小对象'), axes.axis('off'), pylab.show()
单选题 【单选】
所谓连通区域标记,就是将同一个连通区域的所有像素点,都用同一个数值来进行标记。【对】
单选题 【单选】
运用PCA主成分分析算法进行人脸重建时,重建过程中采用的计算法是?
【均值脸+标准方差脸*特征脸】
多选题 【多选】
SIFT描述符算法步骤包括以下哪些步骤?
【ABCD】