报错处理:
libiomp5md.dll报错
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
翻译:正在初始化 libiomp5md.dll,但发现 libiomp5md.dll 已经初始化。 OMP:提示 这意味着 OpenMP 运行时的多个副本已链接到程序中。 这是危险的,因为它会降低性能或导致不正确的结果。 最好的办法是确保只有一个 OpenMP 运行时链接到进程中,例如 通过避免在任何库中静态链接 OpenMP 运行时。 作为一种不安全、不受支持、未记录的解决方法,您可以设置环境变量 KMP_DUPLICATE_LIB_OK=TRUE 以允许程序继续执行,但这可能会导致崩溃或默默地产生不正确的结果。 有关详细信息,请参阅Intel® Product Support
昨天的libiomp5md.dll报错又出现了,但是这次import os 不管用了。
所以尝试第二种处理方法,删除一个libiomp5md.dll文件,在删除过程中,未能在目录中找到ProgramData文件夹,但是键入直接可以进去,所以是被隐藏了。
勾选即可。
报错:AttributeError: 'Series' object has no attribute 'as_matrix'
此处按照网上的教程删除Anaconda3\Library\bin\libiomp5md.dll 程序执行成功。
原代码:landmarks = landmarks_frame.iloc[n, 1:].as_matrix()
更改为:landmarks = landmarks_frame.iloc[n, 1:].values
库版本升级,'as_matrix()‘改为了’values’。
新的知识
主程序
from __future__ import print_function, division
import os
import torch
import pandas as pd
from skimage import io, transform
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import cv2
# Ignore warnings
import warnings
warnings.filterwarnings("ignore")
plt.ion() # interactive mode
# 打开交互模式 在plt.show()之前一定不要忘了加plt.ioff(),如果不加,界面会一闪而过,并不会停留。
landmarks_frame = pd.read_csv('../data/faces/face_landmarks.csv')
n = 34 # 抽取第65个图片来示范
img_name = landmarks_frame.iloc[n, 0] # 第n行第0列,图片名字 第66个图片 person-7.jpg
landmarks = landmarks_frame.iloc[n, 1:].values #返回的是不带标签的数据集
# 第n行第1:列,此时shape: 1:68*2
# print('Landmarks {}'.format(landmarks))
# print('Landmarks shape: {}'.format(landmarks.shape))
landmarks = landmarks.astype('float').reshape(-1, 2) # Landmarks shape: (68, 2)
print('Image name: {}'.format(img_name))
print('Landmarks shape: {}'.format(landmarks.shape))
print('First 4 Landmarks: {}'.format(landmarks[:4])) #0-3点的数据
def show_landmarks(image, landmarks):
"""Show image with landmarks"""
plt.imshow(image)
plt.scatter(landmarks[:, 0], landmarks[:, 1], s=10, marker='.', c='r')
#plt.plot(landmarks[:, 0], landmarks[:, 1],'b')
# 绘线图后有点狰狞(-_-!)
plt.pause(0.001) # pause a bit so that plots are updated
plt.figure() # 创建图像
plt.ioff() # 关闭交互,此刻代码在图片展示完后才可以运行
show_landmarks(io.imread(os.path.join('../data/faces/', img_name)),
landmarks) # (图片路径,图片标点) 功能:定义画布
plt.show() #展示
小结
pandas的切片索引有的都忘记了,需要补补课,今天的内容比较少。草草了事早点休息了。