def run(method_generateFaceRS='hog'): # 读取原始图片与索引 ri, index = readRiIndex() X = extra_feature(ri) X = np.concatenate([index, X], axis=1) # 进行HOG特征处理后,划分数据集,并将结果写到目录里 generateFaceRS(X, method_generateFaceRS)
def run(method_generateFaceRS='densenet'): ri, index = readRiIndex() densenet201 = models.densenet201(pretrained=True) densenet201.fc = nn.Linear(2048, 2048) torch.nn.init.eye(densenet201.fc.weight) for param in densenet201.parameters(): param.requires_grad = False use_gpu = torch.cuda.is_available() X = extra_feature(ri, densenet201, use_gpu) X = np.concatenate([index, X], axis=1) # 进行DenseNet特征处理后,划分数据集,并将结果写到目录里 generateFaceRS(X, method_generateFaceRS)