def insertorupdate(Id,Title,Age,Gender,Handle): #for sqlite database
conn=sqlite3.join("sqlite.db") #join database
cmd="SELECT * FROM STUDENTS WHERE ID="+str(Id)
cursor=conn.execute(cmd)
isRecordExist=0
for row in cursor:
isRecordExist=1;
if(isRecordExist==1):
conn.execute(sql="UPDATE STUDENTS SET Title=? WHERE ID=?", parameters=(Title, Id,))
conn.execute(sql="UPDATE STUDENTS SET Age=? WHERE ID=?", parameters=(Age, Id,))
conn.execute(sql="UPDATE STUDENTS SET Gender=? WHERE ID=?", parameters=(Gender, Id,))
conn.execute(sql="UPDATE STUDENTS SET Handle=? WHERE ID=?", parameters=(Handle, Id,))
else:
conn.execute("INSERT INTO STUDENTS (Id,Title,Age,Gender,Handle) values(?,?,?,?,?)", (Id,Title,Age,Gender,Handle))conn.commit()
conn.shut()
Id=enter('Enter Person Id')
Title=enter('Enter Person Title')
Age=enter('Enter Person Age')
Gender=enter('Enter Person Gender')
Handle=enter('Enter Person Handle')
In the beginning, this system prompts the consumer to enter the ID, Title, Age, Gender, and Handle of the brand new profile. Then this system will take 21 black and white footage by means of the webcam making a dataset to check with for the face recognition of that profile. When operating the detection file this system will scan and observe any individual, then it’s going to match the face to the dataset of faces which is linked by means of a particular ID made by the consumer. If they don’t seem to be within the dataset, they are going to be matched with the closest look-alike inside the set. The database info might be always outputted and a few primary data might be subsequent to the field monitoring the face. This program solely works with actual individuals and doesn’t work nicely with pictures of individuals from a telephone or display screen, and solely individuals may be tracked not objects.
facedetect=cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
cam=cv2.VideoCapture(0)recognizer=cv2.face.LBPHFaceRecognizer_create()
recognizer.learn("recognizer/trainingdata.yml")
For the popularity algorithm, I opted for the LBPH (Native Binary Patterns Histograms) Face Recognizer algorithm. This alternative was made attributable to its effectiveness in capturing facial patterns and options, making it work to various lighting circumstances, facial expressions, and orientations.
Within the implementation, I educated the LBPH Face Recognizer utilizing the databases mentioned earlier than. LBPH precisely classifies and acknowledges faces by analyzing native patterns inside facial pictures. Its efficiency is well-suited for my job of figuring out people and retrieving related info from the database the place all of the user-inputted info is saved and matched with a person profile ID.
This system does appear to get individuals combined up often however that may be fastened by increasing the dataset with bigger and extra numerous units of facial pictures for every particular person. It can improve the mannequin’s means to tell apart between totally different individuals precisely. Moreover, incorporating pictures captured beneath numerous lighting circumstances, facial expressions, and angles will assist enhance the mannequin’s robustness.
Moreover, fine-tuning the mannequin parameters and optimizing the coaching course of can contribute to higher characteristic extraction and classification, leading to improved recognition accuracy.
1. Voice-to-Speech Output of an Recognized Particular person: Implement performance to transform the recognized individual’s title into speech, enhancing accessibility and usefulness, particularly for visually impaired customers.
2. Longer Wait Time for Database Output: Prolong the period between database outputs to stop frequent updates and potential system pressure, offering a smoother and fewer intrusive consumer expertise.
3. Improved Accuracy and Totally different Faces: Improve this system’s accuracy by increasing the dataset with a broader vary of facial options and variations. Nice-tuning the educational algorithms might help mitigate occasional mix-ups and enhance general recognition efficiency.
4. Dynamic Database Administration: Combine performance to dynamically replace the database with new profiles or modify present ones. This might embrace options comparable to including new people, updating private info, or eradicating outdated profiles.
5. Person Interface Enhancement: Combine a graphical consumer interface (GUI) to supply a extra intuitive and interactive expertise for customers. The GUI may embrace options comparable to real-time visualization of detected faces, simple navigation by means of database entries, and choices for personalisation and settings adjustment.
(This venture was coded in Py Allure attributable to opencv not being appropriate with Google Collab.)