Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: invalid literal for int() with base 10: #4

Open
CryptoExchangeFR opened this issue Jun 8, 2018 · 6 comments
Open

ValueError: invalid literal for int() with base 10: #4

CryptoExchangeFR opened this issue Jun 8, 2018 · 6 comments

Comments

@CryptoExchangeFR
Copy link

ops@18:14:[~/Developpement/Facial-Recognition-using-Facenet] python3 rec-feat.py
Using TensorFlow backend.
2018-06-08 18:16:23.935963: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/engine/saving.py:270: UserWarning: No training configuration found in save file: the model was not compiled. Compile it manually.
warnings.warn('No training configuration found in save file: '
Total Params: 3743280
distance for Pierre9 is 0.05126756
distance for Pierre8 is 0.06121227
distance for Pierre5 is 0.06684167
distance for Pierre4 is 0.068645105
distance for Pierre6 is 0.07133803
distance for Pierre7 is 0.067103155
distance for Pierre3 is 0.071579434
distance for Pierre2 is 0.0652888
distance for Pierre1 is 0.05116783
distance for Pierre10 is 0.049484182
Traceback (most recent call last):
File "rec-feat.py", line 112, in
recognize()
File "rec-feat.py", line 103, in recognize
extract_face_info(img, img_rgb, database,ear)
File "rec-feat.py", line 59, in extract_face_info
name, min_dist = recognize_face(image, database)
File "rec-feat.py", line 44, in recognize_face
if int(identity) <=4:
ValueError: invalid literal for int() with base 10: 'Pierre10'

I run create_face.py to get picture of myself. I copy the picture directly in the images folder I created. (Do I need to keep the subfolder with the ID ?)
Then I run rec-feat.py with python3 command.

'PierreX' represent the photo and their associated number.

Do you know how to solve it ?

@sarkarsaikat
Copy link

I solved this by renaming my sample photos in /image as 1.jpg , 2.jpg ,...

@CryptoExchangeFR
Copy link
Author

Thank you for your answer.
This problem seem solved but I have another one.

The script is running well until this error :

Using TensorFlow backend.
2018-06-09 10:19:50.205095: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/engine/saving.py:270: UserWarning: No training configuration found in save file: the model was not compiled. Compile it manually.
warnings.warn('No training configuration found in save file: '
Total Params: 3743280
distance for 8 is 0.05880815
distance for 9 is 0.058217797
distance for 4 is 0.06353997
distance for 5 is 0.059023313
distance for 7 is 0.056130935
distance for 6 is 0.056679048
distance for 2 is 0.060995225
distance for 3 is 0.06437977
distance for 1 is 0.05674781
distance for 0 is 0.057453062
distance for 8 is 0.06155078
distance for 9 is 0.06023829
distance for 4 is 0.065031365
distance for 5 is 0.06051247
distance for 7 is 0.058396123
distance for 6 is 0.057917174
distance for 2 is 0.06269057
distance for 3 is 0.06579694
distance for 1 is 0.05870841
Traceback (most recent call last):
File "rec-feat.py", line 112, in
recognize()
File "rec-feat.py", line 103, in recognize
extract_face_info(img, img_rgb, database,ear)
File "rec-feat.py", line 59, in extract_face_info
name, min_dist = recognize_face(image, database)
TypeError: 'NoneType' object is not iterable

Do you know how to fix this ?

Thanks again :)

@sarkarsaikat
Copy link

sarkarsaikat commented Jun 9, 2018

This has more got to do again with the project has images in the image folder. 1-4 are type A and 5-8 are type B (class or person). But for my use case I would look at identifying individual user per set up I changed the code a little bit in recognize_face:
the for loop in my case is like:

for (name, db_enc) in database.items():
        #print(name)
        # Compute L2 distance between the target "encoding" and the current "emb" from the database.
        dist = np.linalg.norm(db_enc - encoding)

        print('distance for' + str(name) + ' is  ' + str(dist))

        # If this distance is less than the min_dist, then set min_dist to dist, and identity to name
        
        if min_dist < dist:
            min_dist = dist
            name = 'User_Name'

and the return looks like:

if dist < 0.1:
        min_dist = dist
        return name, dist
    else:
        return str('Unknown'), dist

You can adapt as per your need .

@SaravananJaichandar
Copy link

Traceback (most recent call last):
File "rec-feat.py", line 112, in
recognize()
File "rec-feat.py", line 82, in recognize
database = initialize()
File "rec-feat.py", line 77, in initialize
database[identity] = fr_utils.img_path_to_encoding(file, FRmodel)
File "/Users/saravananjaichandar/Downloads/Facial-Recognition-using-Facenet-master/fr_utils.py", line 194, in img_path_to_encoding
return img_to_encoding(img1, model)
File "/Users/saravananjaichandar/Downloads/Facial-Recognition-using-Facenet-master/fr_utils.py", line 198, in img_to_encoding
image = cv2.resize(image, (96, 96))
cv2.error: OpenCV(4.1.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/resize.cpp:3718: error: (-215:Assertion failed) !ssize.empty() in function 'resize'

Assertion error resize function ! Can anyone help regarding this ? @sarkarsaikat @CryptoExchangeFR @akshaybahadur21

@mswipedata
Copy link

Check the value of 'image', most likely it has not been able to read the image.

@hsm4703
Copy link

hsm4703 commented Jun 22, 2019

if i want set two people name sean and leo What program do you want to write?
if dist < 0.1:
min_dist=dist
return name,dist
else:
return str('Unknown'),dist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants