Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
1,260 Views

Intel MKL fatal error

I am trying to do face recognition with Intel edison.

The database I am using is AT&T. I have setup the environment and installed following libraries for doing the job using python:

python-numpy

python-scipy

python scikit-learn

This is the code that I have used.

from sklearn.decomposition import RandomizedPCA

import numpy as np

import glob

import cv2

import math

import os.path

import string

# function to get ID from filename

def ID_from_filename(filename):

part = filename.split('/')

return part[1].replace("s", "")

# function to convert image to right format

def prepare_image(filename):

img_color = cv2.imread(filename)

img_gray = cv2.cvtColor(img_color, cv2.COLOR_BGR2GRAY)

img_gray = cv2.equalizeHist(img_gray)

return img_gray.flat

IMG_RES = 92 * 112 # img resolution

NUM_EIGENFACES = 10 # images per train person

NUM_TRAINIMAGES = 410 # total images in training set

# loading training set from folder train_faces

folders = glob.glob('train_faces/*')

# Create an array with flattened images X

# and an array with ID of the people on each image y

X = np.zeros([NUM_TRAINIMAGES, IMG_RES], dtype='int8')

y = []

# Populate training array with flattened imags from subfolders of train_faces and names

c = 0

for x, folder in enumerate(folders):

train_faces = glob.glob(folder + '/*')

for i, face in enumerate(train_faces):

X[c,:] = prepare_image(face)

y.append(ID_from_filename(face))

c = c + 1

# perform principal component analysis on the images

pca = RandomizedPCA(n_components=NUM_EIGENFACES, whiten=True).fit(X)

X_pca = pca.transform(X)

# load test faces (usually one), located in folder test_faces

test_faces = glob.glob('test_faces/*')

# Create an array with flattened images X

X = np.zeros([len(test_faces), IMG_RES], dtype='int8')

# Populate test array with flattened imags from subfolders of train_faces

for i, face in enumerate(test_faces):

X[i,:] = prepare_image(face)

# run through test images (usually one)

for j, ref_pca in enumerate(pca.transform(X)):

distances = []

# Calculate euclidian distance from test image to each of the known images and save distances

for i, test_pca in enumerate(X_pca):

dist = math.sqrt(sum([diff**2 for diff in (ref_pca - test_pca)]))

distances.append((dist, y[i]))

found_ID = min(distances)[1]

print("Identified (result: "+ str(found_ID) +" - dist - " + str(min(distances)[0]) + ")")

When I run this code, I get the error,

Intel MTK fatal error unable to load libmkl_p4m3.so or libmkl_p4m4.so

Please help this project is very important for me.

Thanks in advance.

Tags (1)
4 Replies
Highlighted
Community Manager
23 Views

Hello Arjun_289,

 

 

Could you explain to us how did you install MKL on your Edison? If I'm not mistaken the issue seems to be that a library from this package cannot be found by the code, this could mean that something might have gone wrong during the library's installation. Or some files are not stored in the correct location.

 

It would be of much help if you explain the steps you've taken so far (how you installed numpy, scipy, mkl, the dependencies, etc).

 

 

Peter.
0 Kudos
Highlighted
New Contributor I
23 Views

Hi Peter,

Thanks for replying.

I have not installed MKL library myself. Since, I wanted to write a face recognition application in python,

I required the following libraries:

python-numpy

python -scipy

python-scikit-learn

python-opencv

In order to cater to this need, I installed miniconda and I installed theses libraries using conda.

One thing I would like to tell you is that I have two pythons of the same version running on edison. One is default and other has come with miniconda.

About the MKL error I haven't installed mkl libraries. I think they should be present by default with the image of yocto present on the board.

Please let me know if installing these can help me with this. I actually don't understand how the mkl libraries are used for performing maths functions, i am quite new to this thing.

0 Kudos
Highlighted
Community Manager
23 Views

The issue does seem to be that MKL is not installed in Edison, installing this library is likely to help you with the project. On a quick search I found https://software.intel.com/en-us/articles/intel-mkl-110-install-guide https://software.intel.com/en-us/articles/intel-mkl-110-install-guide. Why don't you check it and let us know if you are able to get MKL in your Edison.

 

 

Peter.
0 Kudos
Highlighted
New Contributor I
23 Views

Thanks I'll try this out and let you know.

0 Kudos