gargsarthak30 / Face-Recognition-System

Face Recognition System implemented using Python Language. Libraries used: Dlib for implementation and Tkinter for GUI.
1 stars 1 forks source link

Face-Recognition-System Generates Errors. #5

Open Aftab890 opened 7 years ago

Aftab890 commented 7 years ago

Hello gargsarthak30.

I need your help that how to solve these two errors and run your Face-Recognition_System perfectly. I am running Anaconda3 , Python 3.5, dlib 19.1 on windows 10.

1. Error When I try to save my picture in record in registration step, it gives following error

Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\Aftab\Anaconda3\lib\tkinter__init.py", line 1558, in call__ return self.func(*args) File "C:/Users/Aftab/Videos/Face-Recognition-System-master/major_gui.py", line 105, in self.train_1 = Button(self.train_1_frame, text = "First Photo", font = ("Helvetica", 15, "bold"), pady=5, padx=10,relief = "groove", command=lambda: self.click_save(self.new_user_name_field.get(),'first')) File "C:/Users/Aftab/Videos/Face-Recognition-System-master/major_gui.py", line 19, in click_save c.execute_train(filename, dict_name) File "C:\Users\Aftab\Videos\Face-Recognition-System-master\combination.py", line 137, in execute_train frame = imutils.resize(frame, width=400) File "C:\Users\Aftab\Anaconda3\lib\site-packages\imutils\convenience.py", line 69, in resize (h, w) = image.shape[:2] AttributeError: 'NoneType' object has no attribute 'shape'

2. Error When I try to save images record in registration step, it gives following error

Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\Aftab\Anaconda3\lib\tkinter__init.py", line 1558, in call__ return self.func(*args) File "C:/Users/Aftab/Videos/Face-Recognition-System-master/major_gui.py", line 143, in self.train_save = Button(self.train_save_frame, text = "Save Record", font = ("Helvetica", 15, "bold"), pady=5, padx=10, relief = "groove", command=lambda: self.save_record(self.new_user_name_field.get())) File "C:/Users/Aftab/Videos/Face-Recognition-System-master/major_gui.py", line 14, in save_record c.calculate_average(filename) File "C:\Users\Aftab\Videos\Face-Recognition-System-master\combination.py", line 97, in calculate_average self.final_dict = eval(dic[0]) IndexError: list index out of range

gargsarthak30 commented 7 years ago

Hello @Aftab890 Thanks for showing interest in our project. Sorry we forgot to add a user manual file with the project. Following are the steps you need to take in order to overcome the errors:

  1. Whenever you are making a new entry, please make sure to put a "entered name.txt" file in the same directory before executing the program. For example: If I click on new entry button, and enter name as "AFTAB", then I need to have Aftab.txt file in the directory with default content - {}. (Put empty {} in aftab.txt file at the time of its creation).
  2. For clicking photos, you need to press enter key. Hence click 5 photos one after the other by pressing enter key for each button.
  3. For the algorithm to run, a file named shape predictor is used which need to be placed in the same directory in which your python file are put. Link for this file is given below: _https://osdn.net/projects/sfnet_dclib/downloads/dlib/v18.10/shape_predictor_68_face_landmarks.dat.bz2/_

Feel free to contact if you need any other help..!

Aftab890 commented 7 years ago

Hello gargsarthak30.

Thanks for your response, but still i am getting same 2 errors. Which i have mentioned in my first post.

  1. I have downloaded user manual file and put it in the same directory , where the code files are placed.

  2. Manually created the empty text file in the same folder and write default value { } in the file . i-e: Aftab.txt

  3. When i press Enter on photos button, it does not prompt any dialog box or error. While clicking by mouse click, it generates errors. Simply pressing Enter button does not work.

  4. It is also not verifying user

Error

Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\Aftab\Anaconda3\lib\tkinter__init.py", line 1558, in call__ return self.func(*args) File "D:/Face_Recognition/Face-Recognition-Tkinter-GUI/major_gui.py", line 155, in self.verify = Button(self.existing_user_frame, text = "Verify User", font = ("Helvetica", 15, "bold"), pady=5, padx=10, relief = "groove", command=lambda: self.test_user(self.name_field.get())) File "D:/Face_Recognition/Face-Recognition-Tkinter-GUI/major_gui.py", line 10, in test_user c.execute_test(filename) File "D:\Face_Recognition\Face-Recognition-Tkinter-GUI\combination.py", line 194, in execute_test frame = imutils.resize(frame, width=400) File "C:\Users\Aftab\Anaconda3\lib\site-packages\imutils\convenience.py", line 69, in resize (h, w) = image.shape[:2] AttributeError: 'NoneType' object has no attribute 'shape'

gargsarthak30 commented 7 years ago

I have downloaded user manual file and put it in the same directory , where the code files are placed.

By this do you mean that you have downloaded the shape predictor file ? The downloaded file would be having the name as: shape_predictor_68_face_landmarks.dat.bz2 This is a zipped file which needs to be unzipped, you'll get a .dat file and that file needs to be placed in the same directory.

I have synced the major_gui.py file and combination.py file with the one that I am running on my system, Please try to run it again. In case if you still get errors please let me know.

Aftab890 commented 7 years ago

Yes i have unzipped the shape_predictor_68_face_landmarks.dat file in same directory where code is placed. But getting same errors.

Your system only works on images or live camera. ?

gargsarthak30 commented 7 years ago

It works for live camera only.