title
Facial Recognition with Python and the face_recognition library

description
Welcome to a tutorial for implementing the face recognition package for Python. The purpose of this package is to make facial recognition (identifying a face) fairly simple. Kite autocomplete engine for Python: https://kite.com/download/?utm_medium=referral&utm_source=youtube&utm_campaign=sentdex&utm_content=face-rec-python-sentdex Text-based tutorial and sample code: https://pythonprogramming.net/facial-recognition-python/ Channel membership: https://www.youtube.com/channel/UCfzlCWGWYyIQ0aLC5w48gBQ/join Discord: https://discord.gg/sentdex Support the content: https://pythonprogramming.net/support-donate/ Twitter: https://twitter.com/sentdex Instagram: https://instagram.com/sentdex Facebook: https://www.facebook.com/pythonprogramming.net/ Twitch: https://www.twitch.tv/sentdex #facialrecognition #python #tutorial

detail
{'title': 'Facial Recognition with Python and the face_recognition library', 'heatmap': [{'end': 263.851, 'start': 238.64, 'weight': 0.761}, {'end': 1567.928, 'start': 1547.711, 'weight': 0.802}, {'end': 1698.127, 'start': 1658.318, 'weight': 0.719}], 'summary': 'This tutorial covers installing and using the face_recognition package for face detection and recognition, configuring parameters for match accuracy, using opencv to draw rectangles around faces, and troubleshooting issues on ubuntu, providing a comprehensive overview of facial recognition with python and the face_recognition library.', 'chapters': [{'end': 279.653, 'segs': [{'end': 39.773, 'src': 'embed', 'start': 1.52, 'weight': 0, 'content': [{'end': 7.882, 'text': "What's going on everybody and welcome to a tutorial on facial recognition with the face recognition package.", 'start': 1.52, 'duration': 6.362}, {'end': 13.745, 'text': 'So, to get started, you should be able to just do a pip, install face recognition,', 'start': 8.543, 'duration': 5.202}, {'end': 19.647, 'text': 'but depending on your operating system and depending on whether or not you want to use CUDA and so forth,', 'start': 13.745, 'duration': 5.902}, {'end': 22.228, 'text': "there's many different paths that you could take for the installation.", 'start': 19.647, 'duration': 2.581}, {'end': 27.77, 'text': "So check out the text based version of this tutorial if pip install face recognition just doesn't do it for you.", 'start': 22.288, 'duration': 5.482}, {'end': 33.191, 'text': 'So, with that, what I want to do is basically just do kind of an overview of the package and how to use it.', 'start': 28.75, 'duration': 4.441}, {'end': 39.773, 'text': "The package itself is actually extremely simple and there's really like three calls you need to make to the package.", 'start': 33.231, 'duration': 6.542}], 'summary': 'Tutorial on facial recognition with face recognition package, simple with three main calls', 'duration': 38.253, 'max_score': 1.52, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1520.jpg'}, {'end': 104.63, 'src': 'embed', 'start': 60.698, 'weight': 2, 'content': [{'end': 62.059, 'text': "Then we're going to have two directories.", 'start': 60.698, 'duration': 1.361}, {'end': 66.12, 'text': 'One directory is known faces and inside of there is more directories.', 'start': 62.199, 'duration': 3.921}, {'end': 68.943, 'text': 'uh, in this case we just have one.', 'start': 67.321, 'duration': 1.622}, {'end': 69.964, 'text': "it's called syntax.", 'start': 68.943, 'duration': 1.021}, {'end': 77.193, 'text': 'now each directory in the known faces directory is going to have basically a directory of an identity that you wish to identify.', 'start': 69.964, 'duration': 7.229}, {'end': 82.52, 'text': 'so, just as a reminder, face detection is just finding a face right.', 'start': 77.193, 'duration': 5.327}, {'end': 88.448, 'text': 'uh, in imagery or videos or whatever, facial recognition is identifying that face.', 'start': 82.52, 'duration': 5.928}, {'end': 90.851, 'text': 'So face recognition goes a step further.', 'start': 89.129, 'duration': 1.722}, {'end': 93.295, 'text': 'It detects a face and then it recognizes that face.', 'start': 90.871, 'duration': 2.424}, {'end': 95.118, 'text': 'It tells you who that person is or whatever.', 'start': 93.315, 'duration': 1.803}, {'end': 98.422, 'text': "So inside of this directory, CentX, we've got three images.", 'start': 95.738, 'duration': 2.684}, {'end': 104.63, 'text': "None of these images is the greatest in the world, but You can see here we've got this one.", 'start': 99.224, 'duration': 5.406}], 'summary': 'Directory structure for face recognition with 1 known face directory and 1 identity directory; explanation of face detection vs. recognition.', 'duration': 43.932, 'max_score': 60.698, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI60698.jpg'}, {'end': 268.423, 'src': 'heatmap', 'start': 226.014, 'weight': 4, 'content': [{'end': 230.476, 'text': "So the first thing we're gonna do is we're gonna make some imports and then set some constants.", 'start': 226.014, 'duration': 4.462}, {'end': 233.978, 'text': "So we're gonna import face recognition.", 'start': 230.576, 'duration': 3.402}, {'end': 235.278, 'text': "So that's the package that we intend to use.", 'start': 233.998, 'duration': 1.28}, {'end': 238.5, 'text': "We're gonna import OS and we're gonna import CV2.", 'start': 235.298, 'duration': 3.202}, {'end': 243.902, 'text': "So you'd also have to pip install Is it python-opencv? I always forget which one it is.", 'start': 238.64, 'duration': 5.262}, {'end': 247.584, 'text': 'pip install python-opencv.', 'start': 244.983, 'duration': 2.601}, {'end': 249.184, 'text': "I think it's either opencv-.", 'start': 247.664, 'duration': 1.52}, {'end': 251.165, 'text': 'So it must be opencv-python.', 'start': 249.184, 'duration': 1.981}, {'end': 254.807, 'text': 'So pip install opencv-python.', 'start': 251.205, 'duration': 3.602}, {'end': 256.728, 'text': "That's probably it.", 'start': 254.827, 'duration': 1.901}, {'end': 259.829, 'text': 'Oh, I guess I upgraded.', 'start': 258.789, 'duration': 1.04}, {'end': 263.851, 'text': 'That probably just broke the whole tutorial.', 'start': 262.27, 'duration': 1.581}, {'end': 268.423, 'text': 'my life.', 'start': 268.103, 'duration': 0.32}], 'summary': 'Setting up imports for face recognition using cv2 and opencv-python.', 'duration': 42.409, 'max_score': 226.014, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI226014.jpg'}], 'start': 1.52, 'title': 'Facial recognition tutorial', 'summary': 'Provides an overview of installing and using the face recognition package, along with the process of face detection and recognition, and working with known faces and their identities. it also discusses setting up a facial recognition tutorial, including known and unknown faces directory, multiple faces in images, and importing necessary packages for the tutorial.', 'chapters': [{'end': 125.197, 'start': 1.52, 'title': 'Facial recognition tutorial', 'summary': 'Provides an overview of installing and using the face recognition package, along with the process of face detection and recognition, and working with known faces and their identities.', 'duration': 123.677, 'highlights': ['The face recognition package installation process varies based on operating system and CUDA usage. The installation of the face recognition package depends on the operating system and the choice of using CUDA, leading to multiple installation paths.', 'The package requires only three main calls, with additional boilerplate code around it. The face recognition package involves making three main calls, with the rest being additional code around it for utilization.', 'Explanation of the difference between face detection and facial recognition, with an example of known faces and their identities. The distinction between face detection and facial recognition is provided, along with an example of known faces and their respective identities.']}, {'end': 279.653, 'start': 125.237, 'title': 'Facial recognition tutorial setup', 'summary': 'Discusses setting up a facial recognition tutorial, including known and unknown faces directory, multiple faces in images, and importing necessary packages for the tutorial.', 'duration': 154.416, 'highlights': ['Setting up known and unknown faces directory for facial recognition tutorial The chapter discusses setting up a directory for known faces with identities and a directory for unknown faces, including multiple faces in images.', 'Importing necessary packages for the facial recognition tutorial The tutorial covers the import of face recognition, OS, and CV2 packages, along with the requirement to pip install opencv-python for image tasks.']}], 'duration': 278.133, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1520.jpg', 'highlights': ['The installation of the face recognition package depends on the operating system and the choice of using CUDA, leading to multiple installation paths.', 'The face recognition package involves making three main calls, with the rest being additional code around it for utilization.', 'The distinction between face detection and facial recognition is provided, along with an example of known faces and their respective identities.', 'The chapter discusses setting up a directory for known faces with identities and a directory for unknown faces, including multiple faces in images.', 'The tutorial covers the import of face recognition, OS, and CV2 packages, along with the requirement to pip install opencv-python for image tasks.']}, {'end': 1061.032, 'segs': [{'end': 356.607, 'src': 'embed', 'start': 310.879, 'weight': 0, 'content': [{'end': 318.462, 'text': "So if you set a very, very low tolerance, but you only have like one or two pictures of the identity, chances are it's never going to make a match.", 'start': 310.879, 'duration': 7.583}, {'end': 322.585, 'text': 'So the default with face recognition is 0.6.', 'start': 318.823, 'duration': 3.762}, {'end': 330.83, 'text': "If you want to make more matches but you're willing to risk being incorrect on the match that you make, you can set tolerance to be like 1.0,", 'start': 322.585, 'duration': 8.245}, {'end': 331.07, 'text': 'very high.', 'start': 330.83, 'duration': 0.24}, {'end': 337.435, 'text': "But if you want to only match if it's like a for sure thing, set the tolerance to be quite low.", 'start': 332.431, 'duration': 5.004}, {'end': 347.221, 'text': "I have found 0.6 to be pretty good, but as we'll see, we'll probably have issues with that, both missing predictions and then as we try to lower it.", 'start': 338.375, 'duration': 8.846}, {'end': 348.201, 'text': "it's quite challenging.", 'start': 347.221, 'duration': 0.98}, {'end': 356.607, 'text': "Ideally, you would have like 100 images of somebody's face and different lighting conditions and looking up in every,", 'start': 349.202, 'duration': 7.405}], 'summary': 'Setting face recognition tolerance at 0.6 yields good results, but may lead to missed predictions and challenges when lowered.', 'duration': 45.728, 'max_score': 310.879, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI310879.jpg'}, {'end': 404.239, 'src': 'embed', 'start': 376.145, 'weight': 2, 'content': [{'end': 380.028, 'text': "i guess you would call it false negatives, right, so you're gonna miss matches.", 'start': 376.145, 'duration': 3.883}, {'end': 385.435, 'text': "So now we're going to say frame underscore thickness.", 'start': 381.334, 'duration': 4.101}, {'end': 386.835, 'text': 'This will be in pixel values.', 'start': 385.555, 'duration': 1.28}, {'end': 388.536, 'text': "Basically, we're going to draw a square around the head.", 'start': 386.875, 'duration': 1.661}, {'end': 394.117, 'text': "How many pixels do you want that to be? That's going to depend on how big of an image are you using.", 'start': 389.336, 'duration': 4.781}, {'end': 396.297, 'text': "In our case, I'm going to use three.", 'start': 394.637, 'duration': 1.66}, {'end': 399.398, 'text': "And then we'll do font thickness.", 'start': 397.317, 'duration': 2.081}, {'end': 401.858, 'text': "I'm going to set that to be two.", 'start': 399.718, 'duration': 2.14}, {'end': 404.239, 'text': "And then model, I'm going to use.", 'start': 402.459, 'duration': 1.78}], 'summary': 'Adjustments made for false negatives, frame thickness, and font thickness in pixels.', 'duration': 28.094, 'max_score': 376.145, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI376145.jpg'}, {'end': 459.322, 'src': 'embed', 'start': 427.355, 'weight': 3, 'content': [{'end': 429.416, 'text': 'so, um, you can use either one you want.', 'start': 427.355, 'duration': 2.061}, {'end': 432.517, 'text': 'I suspect hog is going to run better on the CPU.', 'start': 429.416, 'duration': 3.101}, {'end': 439.359, 'text': "so if you're only on a CPU you didn't install the CUDA, uh, dlib, then I might suggest that you use hog instead.", 'start': 432.517, 'duration': 6.842}, {'end': 444.709, 'text': "that's quite literally, uh, HOG, um, Or feel free to tinker with both.", 'start': 439.359, 'duration': 5.35}, {'end': 449.353, 'text': 'CNN will still run on a CPU, it just might be kind of slow.', 'start': 444.769, 'duration': 4.584}, {'end': 453.997, 'text': "Okay, so once we've got that, the next thing we're ready to do is start loading in faces.", 'start': 450.094, 'duration': 3.903}, {'end': 459.322, 'text': 'So to do image facial recognition, we need to be able to do kind of two things right?', 'start': 454.057, 'duration': 5.265}], 'summary': 'Use hog for better cpu performance over cnn.', 'duration': 31.967, 'max_score': 427.355, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI427355.jpg'}, {'end': 492.417, 'src': 'embed', 'start': 466.008, 'weight': 4, 'content': [{'end': 474.892, 'text': "So the first step that we're gonna do is load in all of our known faces, so that we have something for the unknown faces to compare to.", 'start': 466.008, 'duration': 8.884}, {'end': 483.154, 'text': "So we'll come down here and we will just print just some debugging information, loading known faces.", 'start': 476.072, 'duration': 7.082}, {'end': 486.475, 'text': "And basically we're gonna have two lists.", 'start': 484.255, 'duration': 2.22}, {'end': 488.616, 'text': "We're gonna say known faces.", 'start': 486.515, 'duration': 2.101}, {'end': 491.137, 'text': 'These will be the actual encoded faces.', 'start': 488.656, 'duration': 2.481}, {'end': 492.417, 'text': "You'll know what I'm saying in a minute.", 'start': 491.177, 'duration': 1.24}], 'summary': 'Loading known faces for comparison in facial recognition.', 'duration': 26.409, 'max_score': 466.008, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI466008.jpg'}, {'end': 760.222, 'src': 'embed', 'start': 727.695, 'weight': 5, 'content': [{'end': 732.52, 'text': "so now what we want to do is so we've got the known faces so we can compare to them.", 'start': 727.695, 'duration': 4.825}, {'end': 740.448, 'text': 'now we want to do is we want to iterate over all of the unknown images, find all of the faces and then, for each face,', 'start': 732.52, 'duration': 7.928}, {'end': 745.274, 'text': 'compare that face to each of the known faces.', 'start': 740.448, 'duration': 4.826}, {'end': 750.197, 'text': 'so okay, lots of lots of looping about to occur.', 'start': 745.274, 'duration': 4.923}, {'end': 760.222, 'text': "so now we're going to say is print process, unknown faces and cool.", 'start': 750.197, 'duration': 10.025}], 'summary': 'Iterating over unknown images to compare with known faces for facial recognition.', 'duration': 32.527, 'max_score': 727.695, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI727695.jpg'}, {'end': 950.312, 'src': 'embed', 'start': 922.833, 'weight': 6, 'content': [{'end': 926.035, 'text': "So first we're going to convert this image so we can use it with open CV.", 'start': 922.833, 'duration': 3.202}, {'end': 929.776, 'text': "So we're going to say image equals CV two dot.", 'start': 926.055, 'duration': 3.721}, {'end': 932.497, 'text': "And what we're looking for is convert color.", 'start': 930.216, 'duration': 2.281}, {'end': 934.098, 'text': 'Yes Convert color.', 'start': 932.797, 'duration': 1.301}, {'end': 947.83, 'text': "um, and we are going to do this on the image and then we're going to do cv2, dot, um color, rgc, rg, shoot, what are we looking for?", 'start': 935.257, 'duration': 12.573}, {'end': 950.312, 'text': "i think we're looking for rgb to bgr.", 'start': 947.83, 'duration': 2.482}], 'summary': 'Convert image to use with opencv, converting rgb to bgr.', 'duration': 27.479, 'max_score': 922.833, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI922833.jpg'}], 'start': 280.493, 'title': 'Face recognition configuration and loading known faces', 'summary': 'Discusses configuring face recognition parameters and loading known faces for facial recognition, highlighting the impact of settings on match accuracy and false positives/negatives, and the process of encoding and storing known faces, iterating over unknown images, and converting images to bgr for processing.', 'chapters': [{'end': 449.353, 'start': 280.493, 'title': 'Face recognition configuration', 'summary': 'Discusses configuring face recognition parameters such as tolerance, frame thickness, and model selection, highlighting the impact of these settings on match accuracy and false positives/negatives.', 'duration': 168.86, 'highlights': ['The lower the tolerance, the less chance of false positives, default face recognition tolerance is 0.6. default face recognition tolerance is 0.6', 'Setting a very low tolerance with only one or two pictures of the identity will likely never make a match. setting a very low tolerance with only one or two pictures', "Using 100 images of somebody's face with different lighting conditions is ideal for matching accuracy. ideal to use 100 images of somebody's face with different lighting conditions", 'The higher the frame thickness, the larger the square drawn around the head, default frame thickness is three pixels. default frame thickness is three pixels', 'The model selection between CNN and HOG impacts processing speed, with HOG likely to run better on the CPU. HOG likely to run better on the CPU']}, {'end': 1061.032, 'start': 450.094, 'title': 'Facial recognition: loading known faces', 'summary': 'Discusses the process of loading known faces for facial recognition, iterating over known faces to encode and store their information, iterating over unknown images to find and encode faces for comparison, and converting images to bgr using opencv for further processing.', 'duration': 610.938, 'highlights': ['Iterating over known faces to encode and store their information The chapter explains the process of iterating over known faces, encoding the images, and storing the information in known faces and known names lists.', 'Iterating over unknown images to find and encode faces for comparison The transcript details the process of iterating over unknown images, finding and encoding faces for comparison with known faces.', 'Converting images to BGR using OpenCV for further processing The chapter mentions the use of OpenCV to convert images to BGR for further processing in the facial recognition system.']}], 'duration': 780.539, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI280493.jpg', 'highlights': ["Using 100 images of somebody's face with different lighting conditions is ideal for matching accuracy.", 'The lower the tolerance, the less chance of false positives, default face recognition tolerance is 0.6.', 'The higher the frame thickness, the larger the square drawn around the head, default frame thickness is three pixels.', 'The model selection between CNN and HOG impacts processing speed, with HOG likely to run better on the CPU.', 'Iterating over known faces to encode and store their information.', 'Iterating over unknown images to find and encode faces for comparison.', 'Converting images to BGR using OpenCV for further processing.']}, {'end': 1356.891, 'segs': [{'end': 1163.473, 'src': 'embed', 'start': 1063.863, 'weight': 0, 'content': [{'end': 1066.064, 'text': "So, okay, so we've got our image.", 'start': 1063.863, 'duration': 2.201}, {'end': 1075.049, 'text': "Now what we're ready to do is iterate over the encodings and locations for the unknown faces that are found.", 'start': 1066.625, 'duration': 8.424}, {'end': 1090.06, 'text': "So what we're gonna say is, we'll come down one more line, for face underscore encoding, and then face underscore location in zip encodings locations.", 'start': 1075.43, 'duration': 14.63}, {'end': 1095.802, 'text': 'So for each of those what we want to do is first we want to see are there any matches that we can find.', 'start': 1091.06, 'duration': 4.742}, {'end': 1100.384, 'text': 'So here comes what I believe to be the third and final line.', 'start': 1095.862, 'duration': 4.522}, {'end': 1102.725, 'text': 'of the face recognition package.', 'start': 1101.204, 'duration': 1.521}, {'end': 1107.568, 'text': 'And the rest of this stuff is just like, like I said, just code to do all the other things that you want to do.', 'start': 1102.845, 'duration': 4.723}, {'end': 1116.714, 'text': "We're going to say results equals face underscore recognition dot compare faces, compare faces.", 'start': 1107.588, 'duration': 9.126}, {'end': 1123.915, 'text': "And then we're going to compare known faces to the face encoding at the moment.", 'start': 1117.674, 'duration': 6.241}, {'end': 1127.816, 'text': "So we're basically this will be the list of known faces that you have.", 'start': 1124.135, 'duration': 3.681}, {'end': 1130.357, 'text': "This is the thing that you're trying to compare to see.", 'start': 1128.316, 'duration': 2.041}, {'end': 1137.398, 'text': 'Are there any matches? And then at what tolerance do you want to use? Again, the default tolerance is 0.6.', 'start': 1130.417, 'duration': 6.981}, {'end': 1138.738, 'text': "That's what we're going to go with to start.", 'start': 1137.398, 'duration': 1.34}, {'end': 1142.319, 'text': "But I'll show you guys some some variances as well.", 'start': 1138.778, 'duration': 3.541}, {'end': 1152.246, 'text': "So now what results are going to be is it's going to compare the current encoding to every single face that we know about.", 'start': 1144.301, 'duration': 7.945}, {'end': 1155.387, 'text': "And then it's going to return to us a list of Boolean.", 'start': 1152.686, 'duration': 2.701}, {'end': 1156.548, 'text': "So it's just true or false.", 'start': 1155.428, 'duration': 1.12}, {'end': 1163.473, 'text': 'And you might have multiple trues and then, you know, like, In our case, we only have one known face.', 'start': 1157.289, 'duration': 6.184}], 'summary': 'Using face recognition package to compare and find matches in known faces, with default tolerance of 0.6.', 'duration': 99.61, 'max_score': 1063.863, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1063863.jpg'}, {'end': 1215.123, 'src': 'embed', 'start': 1182.167, 'weight': 1, 'content': [{'end': 1185.009, 'text': "So in the known names list, you're going to have that list of identities.", 'start': 1182.167, 'duration': 2.842}, {'end': 1190.394, 'text': "So at the exact same index, you'll have the name for that face encoding that we know about.", 'start': 1185.05, 'duration': 5.344}, {'end': 1202.118, 'text': "so what we're going to do in this case is we're just going to say currently match equals none and then we're going to say if true in results.", 'start': 1190.954, 'duration': 11.164}, {'end': 1204.659, 'text': 'so as long as we got a single true,', 'start': 1202.118, 'duration': 2.541}, {'end': 1215.123, 'text': "we're going to say the match is the known names and then we're going to grab the index and basically we're going to say results.index for true.", 'start': 1204.659, 'duration': 10.464}], 'summary': 'Matching known identities with face encodings to determine a match.', 'duration': 32.956, 'max_score': 1182.167, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1182167.jpg'}, {'end': 1283.85, 'src': 'embed', 'start': 1254.454, 'weight': 3, 'content': [{'end': 1256.435, 'text': 'So yeah, we got, we definitely have to do that.', 'start': 1254.454, 'duration': 1.981}, {'end': 1262.078, 'text': "so what we're going to say here is uh, we need to get the the coordinates for the match.", 'start': 1257.455, 'duration': 4.623}, {'end': 1263.338, 'text': "so we're going to say, and the way,", 'start': 1262.078, 'duration': 1.26}, {'end': 1269.302, 'text': "that what you're going to do anytime like we're going to use cv2.rectangle to draw a rectangle like around the face.", 'start': 1263.338, 'duration': 5.964}, {'end': 1275.805, 'text': 'to draw a rectangle, you just need two things you need the top left coordinate and the bottom right coordinate, and then it draws the rectangle.', 'start': 1269.302, 'duration': 6.503}, {'end': 1283.85, 'text': "so we're going to grab top left and that is going to be the face location.", 'start': 1275.805, 'duration': 8.045}], 'summary': 'Using cv2.rectangle to draw a rectangle around the face using coordinates.', 'duration': 29.396, 'max_score': 1254.454, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1254454.jpg'}], 'start': 1063.863, 'title': 'Face recognition and opencv', 'summary': 'Covers iterating over face encodings, comparing them to known faces, setting a default tolerance of 0.6. it also explains a facial recognition algorithm that compares encodings, returns boolean values, identifies matches, and focuses on using opencv to draw a rectangle around a face in an image.', 'chapters': [{'end': 1142.319, 'start': 1063.863, 'title': 'Face recognition iteration', 'summary': 'Covers iterating over face encodings and locations, comparing them to known faces, and setting a default tolerance of 0.6 for the comparison.', 'duration': 78.456, 'highlights': ['Iterating over face encodings and locations for unknown faces found', 'Comparing unknown faces to a list of known faces to find matches', 'Setting a default tolerance of 0.6 for the comparison']}, {'end': 1233.005, 'start': 1144.301, 'title': 'Facial recognition algorithm', 'summary': 'Explains a facial recognition algorithm that compares a current encoding with known faces, returning a list of boolean values, and then identifying the match by checking the known names list.', 'duration': 88.704, 'highlights': ['The algorithm compares the current encoding to known faces and returns a list of Boolean values, which indicates whether a match is found.', 'The known names list contains identities corresponding to the face encodings, allowing for identification of the matched face by checking the index of the true Boolean values in the results.', 'The algorithm identifies a match by checking if there is at least one true Boolean value in the results, then retrieves the corresponding identity from the known names list.', 'The chapter explains the process of identifying a match using a facial recognition algorithm, which involves comparing face encodings and retrieving corresponding identities from a known names list.']}, {'end': 1356.891, 'start': 1233.545, 'title': 'Opencv rectangle drawing', 'summary': 'Focuses on using opencv to draw a rectangle around a face in an image, specifying the coordinates and color, with potential for application in video processing and advanced features.', 'duration': 123.346, 'highlights': ['Using cv2.rectangle, we need the top left and bottom right coordinates to draw a rectangle around the face, with a specified color (0, 255, 0 for green).', 'The tutorial hints at dynamically picking a color based on identity and mentions potential application in video processing, showcasing more advanced features depending on interest.']}], 'duration': 293.028, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1063863.jpg', 'highlights': ['The algorithm compares the current encoding to known faces and returns a list of Boolean values, which indicates whether a match is found.', 'The known names list contains identities corresponding to the face encodings, allowing for identification of the matched face by checking the index of the true Boolean values in the results.', 'The algorithm identifies a match by checking if there is at least one true Boolean value in the results, then retrieves the corresponding identity from the known names list.', 'Using cv2.rectangle, we need the top left and bottom right coordinates to draw a rectangle around the face, with a specified color (0, 255, 0 for green).', 'Iterating over face encodings and locations for unknown faces found', 'Comparing unknown faces to a list of known faces to find matches', 'Setting a default tolerance of 0.6 for the comparison', 'The chapter explains the process of identifying a match using a facial recognition algorithm, which involves comparing face encodings and retrieving corresponding identities from a known names list.']}, {'end': 1567.928, 'segs': [{'end': 1385.114, 'src': 'embed', 'start': 1357.831, 'weight': 0, 'content': [{'end': 1364.274, 'text': "But anyways, for now we'll just have a static color, but you can check the text-based version of the tutorial for a function Daniel came up with,", 'start': 1357.831, 'duration': 6.443}, {'end': 1364.835, 'text': 'which is pretty cool.', 'start': 1364.274, 'duration': 0.561}, {'end': 1366.856, 'text': 'So now we have our color now.', 'start': 1365.835, 'duration': 1.021}, {'end': 1369.018, 'text': 'We want to actually draw the rectangle so to make a rectangle.', 'start': 1366.896, 'duration': 2.122}, {'end': 1375.224, 'text': "It's just cv2 rectangle Now again, so cv2 kite is a little better at cv2.", 'start': 1369.038, 'duration': 6.186}, {'end': 1378.728, 'text': 'They know a lot of things there So lots of great suggestions from here.', 'start': 1375.264, 'duration': 3.464}, {'end': 1385.114, 'text': "So anyway image, so we're gonna draw the rectangle on the image We're gonna draw it at top left.", 'start': 1378.808, 'duration': 6.306}], 'summary': 'Tutorial includes function for static color and drawing rectangle.', 'duration': 27.283, 'max_score': 1357.831, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1357831.jpg'}, {'end': 1567.928, 'src': 'heatmap', 'start': 1520.215, 'weight': 1, 'content': [{'end': 1530.478, 'text': "so At this coordinate we're going to say plus 10, and then over here we're going to say plus 15, just to kind of adjust it somewhere in the middle.", 'start': 1520.215, 'duration': 10.263}, {'end': 1535.42, 'text': "Then we're going to specify our font.", 'start': 1531.639, 'duration': 3.781}, {'end': 1543.223, 'text': "So the font that we want to use, again, cv2.hershesimplex, that'll be fine.", 'start': 1537.301, 'duration': 5.922}, {'end': 1547.611, 'text': "Uh, then we're going to say 0.5 will be the size.", 'start': 1544.528, 'duration': 3.083}, {'end': 1548.913, 'text': 'Now you can specify the color.', 'start': 1547.711, 'duration': 1.202}, {'end': 1553.978, 'text': "In this case, we'll just do like kind of like a barely off white and then whatever our font thickness was.", 'start': 1549.133, 'duration': 4.845}, {'end': 1559.284, 'text': 'If you want to make that a multi-line function or multi-line of parameters, feel free.', 'start': 1554.539, 'duration': 4.745}, {'end': 1561.107, 'text': "That's quite, quite a long line.", 'start': 1559.425, 'duration': 1.682}, {'end': 1567.928, 'text': 'Okay So that puts our text on the image.', 'start': 1563.249, 'duration': 4.679}], 'summary': 'Adjusting coordinates by plus 10 and plus 15, specifying font and color for text on the image.', 'duration': 28.698, 'max_score': 1520.215, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1520215.jpg'}], 'start': 1357.831, 'title': 'Drawing rectangles and text', 'summary': 'Discusses the process of drawing rectangles and text on an image using cv2.rectangle and cv2.puttext, including the coordinates, color, and font specifications.', 'chapters': [{'end': 1567.928, 'start': 1357.831, 'title': 'Drawing rectangles and text', 'summary': 'Discusses the process of drawing rectangles and text on an image using cv2.rectangle and cv2.puttext, including the coordinates, color, and font specifications.', 'duration': 210.097, 'highlights': ['The chapter discusses the process of drawing rectangles and text on an image using cv2.rectangle and cv2.putText It covers the process of drawing rectangles and text on an image using cv2.rectangle and cv2.putText.', 'The chapter explains the coordinates, color, and font specifications for drawing the rectangles and text It explains the specific coordinates, color, and font specifications required for drawing the rectangles and text.', 'The tutorial mentions using cv2.hershesimplex as the font and specifies the font size as 0.5 It mentions the use of cv2.hershesimplex as the font and specifies the font size as 0.5.']}], 'duration': 210.097, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1357831.jpg', 'highlights': ['The chapter discusses the process of drawing rectangles and text on an image using cv2.rectangle and cv2.putText.', 'The chapter explains the coordinates, color, and font specifications for drawing the rectangles and text.', 'The tutorial mentions using cv2.hershesimplex as the font and specifies the font size as 0.5.']}, {'end': 1863.394, 'segs': [{'end': 1617.551, 'src': 'embed', 'start': 1568.448, 'weight': 2, 'content': [{'end': 1578.813, 'text': "And now, now that we've done that, basically what we wanna do is we wanna, for every unknown image, we wanna do this whole block all at once.", 'start': 1568.448, 'duration': 10.365}, {'end': 1582.794, 'text': "And then when we're all done, right, for each image, we wanna show the image.", 'start': 1579.273, 'duration': 3.521}, {'end': 1585.055, 'text': "So I'm gonna say cv2, oops, cv2.wow, mshow.", 'start': 1582.834, 'duration': 2.221}, {'end': 1594.3, 'text': "And we're going to show the file name, and then we're going to the actual image.", 'start': 1588.917, 'duration': 5.383}, {'end': 1598.422, 'text': 'Did that just freeze again on me? Are you kidding me? Okay, trying that again.', 'start': 1594.36, 'duration': 4.062}, {'end': 1603.824, 'text': 'mshow I need to figure out why is that lagging out on me.', 'start': 1598.682, 'duration': 5.142}, {'end': 1606.586, 'text': 'Okay, so we mshow.', 'start': 1605.265, 'duration': 1.321}, {'end': 1609.427, 'text': "This is the title of the image, just in case you don't know what CV2 is doing.", 'start': 1606.646, 'duration': 2.781}, {'end': 1611.588, 'text': 'And then this is the actual image that we wish to show.', 'start': 1609.707, 'duration': 1.881}, {'end': 1617.551, 'text': "Then we're going to do CV2.weightkey0, so just as soon as we're ready.", 'start': 1612.408, 'duration': 5.143}], 'summary': 'Processing and displaying unknown images using cv2 library.', 'duration': 49.103, 'max_score': 1568.448, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1568448.jpg'}, {'end': 1700.57, 'src': 'heatmap', 'start': 1642.794, 'weight': 3, 'content': [{'end': 1647.935, 'text': "So if you're on Windows and maybe Mac, I'm not sure, but I think it's for any Nix type operating system.", 'start': 1642.794, 'duration': 5.141}, {'end': 1649.535, 'text': "But anyway, I'm going to comment that out.", 'start': 1647.975, 'duration': 1.56}, {'end': 1652.456, 'text': "And I'm actually going to say cv2.waitkey 10, 000.", 'start': 1649.935, 'duration': 2.521}, {'end': 1653.936, 'text': "So it's in milliseconds, so 10 seconds.", 'start': 1652.456, 'duration': 1.48}, {'end': 1658.238, 'text': "And if we press a key at any point, we'll continue to the next image.", 'start': 1654.916, 'duration': 3.322}, {'end': 1660.12, 'text': "But anyway, it's super messy.", 'start': 1658.318, 'duration': 1.802}, {'end': 1663.642, 'text': 'I so rarely work with OpenCV on Ubuntu.', 'start': 1660.6, 'duration': 3.042}, {'end': 1666.724, 'text': "Actually, I work with it, but I don't really display things live.", 'start': 1663.982, 'duration': 2.742}, {'end': 1668.485, 'text': "So I haven't really run into this issue very much.", 'start': 1666.744, 'duration': 1.741}, {'end': 1671.867, 'text': "But anyway, that'll be a temporary solution to that problem.", 'start': 1668.625, 'duration': 3.242}, {'end': 1674.489, 'text': "That's not the directory we want to be in.", 'start': 1673.088, 'duration': 1.401}, {'end': 1676.61, 'text': 'So let me just open it here.', 'start': 1675.209, 'duration': 1.401}, {'end': 1677.611, 'text': 'Open in terminal.', 'start': 1676.811, 'duration': 0.8}, {'end': 1681.393, 'text': "We'll do Python face rec example.py.", 'start': 1678.352, 'duration': 3.041}, {'end': 1683.535, 'text': "So let's see how we've done.", 'start': 1682.054, 'duration': 1.481}, {'end': 1688.618, 'text': 'So it loads the known faces.', 'start': 1687.557, 'duration': 1.061}, {'end': 1690.28, 'text': 'Boom Okay.', 'start': 1688.658, 'duration': 1.622}, {'end': 1691.04, 'text': 'No match here.', 'start': 1690.38, 'duration': 0.66}, {'end': 1691.601, 'text': "That's good.", 'start': 1691.1, 'duration': 0.501}, {'end': 1692.662, 'text': "I'll press a key.", 'start': 1691.941, 'duration': 0.721}, {'end': 1693.283, 'text': "Hopefully we'll get it.", 'start': 1692.682, 'duration': 0.601}, {'end': 1694.564, 'text': 'Great Awesome.', 'start': 1693.503, 'duration': 1.061}, {'end': 1696.606, 'text': "I think if we just close it, it'll be no good.", 'start': 1695.044, 'duration': 1.562}, {'end': 1698.127, 'text': "So I'll just keep pressing keys for now.", 'start': 1696.866, 'duration': 1.261}, {'end': 1700.57, 'text': "Okay So then here we've got a ton of match in syntax.", 'start': 1698.308, 'duration': 2.262}], 'summary': 'Using opencv on ubuntu, a python script processes images and displays matches.', 'duration': 57.776, 'max_score': 1642.794, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1642794.jpg'}, {'end': 1804.866, 'src': 'embed', 'start': 1769.391, 'weight': 1, 'content': [{'end': 1769.892, 'text': "We're in trouble.", 'start': 1769.391, 'duration': 0.501}, {'end': 1773.035, 'text': 'I think 0.3 is going to be too low.', 'start': 1771.493, 'duration': 1.542}, {'end': 1773.996, 'text': 'Oh, boy.', 'start': 1773.436, 'duration': 0.56}, {'end': 1778.502, 'text': 'So we did not get that guy in the background, but as you can see, you set the tolerance too low, you get no matches.', 'start': 1774.497, 'duration': 4.005}, {'end': 1780.103, 'text': 'So many false negatives here.', 'start': 1778.902, 'duration': 1.201}, {'end': 1783.557, 'text': 'Really Not a single match.', 'start': 1780.884, 'duration': 2.673}, {'end': 1786.619, 'text': 'Not a single match.', 'start': 1785.138, 'duration': 1.481}, {'end': 1788.48, 'text': "Okay, let's try 0.5.", 'start': 1787.34, 'duration': 1.14}, {'end': 1792.784, 'text': "Let's just go slightly different than the other tolerance.", 'start': 1788.48, 'duration': 4.304}, {'end': 1804.866, 'text': 'Okay, so that worked out pretty well.', 'start': 1801.502, 'duration': 3.364}], 'summary': 'Adjusting tolerance from 0.3 to 0.5 improved matching results.', 'duration': 35.475, 'max_score': 1769.391, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1769391.jpg'}, {'end': 1860.411, 'src': 'embed', 'start': 1828.245, 'weight': 0, 'content': [{'end': 1829.848, 'text': 'You can keep your tolerance kind of high.', 'start': 1828.245, 'duration': 1.603}, {'end': 1831.59, 'text': "You're going to get much less false negatives.", 'start': 1829.868, 'duration': 1.722}, {'end': 1834.612, 'text': 'So yeah, feel free to tinker around.', 'start': 1833.291, 'duration': 1.321}, {'end': 1837.694, 'text': 'Like I said, you can do this not only on images but also video.', 'start': 1834.652, 'duration': 3.042}, {'end': 1841.116, 'text': "Frame rate is going to vary significantly depending on what kind of machine you're running it on.", 'start': 1837.774, 'duration': 3.342}, {'end': 1846.019, 'text': "If there's enough interest, I will follow up this video with another video,", 'start': 1841.937, 'duration': 4.082}, {'end': 1851.643, 'text': 'doing this with video and then hopefully adding something a little more unique and interesting to that.', 'start': 1846.019, 'duration': 5.624}, {'end': 1853.324, 'text': "We'll see if I end up doing it.", 'start': 1852.063, 'duration': 1.261}, {'end': 1860.411, 'text': 'But if you have questions, comments, concerns, whatever, feel free to leave those below.', 'start': 1854.905, 'duration': 5.506}], 'summary': 'Higher tolerance yields fewer false negatives, applicable to both images and video. frame rate varies based on machine. potential for follow-up video with unique content.', 'duration': 32.166, 'max_score': 1828.245, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1828245.jpg'}], 'start': 1568.448, 'title': 'Using cv2 for image processing and face recognition with opencv on ubuntu', 'summary': 'Covers displaying multiple images with cv2, addressing lagging issues, troubleshooting opencv issues on ubuntu, setting time delays, fine-tuning face recognition tolerance, and providing examples of false positives and negatives in face detection.', 'chapters': [{'end': 1617.551, 'start': 1568.448, 'title': 'Image processing with cv2', 'summary': 'Discusses the process of displaying multiple images using cv2, with a focus on showing the title and actual image for each, while encountering lagging issues.', 'duration': 49.103, 'highlights': ['CV2.weightkey0 is used to wait until the user is ready to proceed with displaying the image.', 'The chapter emphasizes displaying the title and actual image for each unknown image using CV2.', 'The speaker encounters lagging issues while attempting to display the images using CV2.']}, {'end': 1863.394, 'start': 1617.987, 'title': 'Opencv on ubuntu issues and face recognition', 'summary': 'Discusses troubleshooting opencv issues on ubuntu, setting time delays, and fine-tuning face recognition tolerance, with examples of false positives and negatives in face detection.', 'duration': 245.407, 'highlights': ["The chapter discusses troubleshooting OpenCV issues on Ubuntu and setting time delays, such as using 'cv2.waitkey 10,000' for a 10-second delay.", 'The section demonstrates fine-tuning face recognition tolerance, with examples of false positives and false negatives, showcasing the impact of setting the tolerance level at 0.3 and 0.5.', 'The speaker mentions the potential for increased accuracy in face recognition with more examples and advises experimenting with the tolerance level to minimize false negatives, highlighting the flexibility of the face recognition system.', 'The chapter concludes with a mention of the possibility of extending the demonstration to video processing and invites viewer engagement for feedback and further discussions on the topic.']}], 'duration': 294.946, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/535acCxjHCI/pics/535acCxjHCI1568448.jpg', 'highlights': ['The speaker mentions the potential for increased accuracy in face recognition with more examples and advises experimenting with the tolerance level to minimize false negatives, highlighting the flexibility of the face recognition system.', 'The section demonstrates fine-tuning face recognition tolerance, with examples of false positives and false negatives, showcasing the impact of setting the tolerance level at 0.3 and 0.5.', 'The chapter emphasizes displaying the title and actual image for each unknown image using CV2.', "The chapter discusses troubleshooting OpenCV issues on Ubuntu and setting time delays, such as using 'cv2.waitkey 10,000' for a 10-second delay.", 'CV2.weightkey0 is used to wait until the user is ready to proceed with displaying the image.']}], 'highlights': ['The tutorial covers installing and using the face_recognition package for face detection and recognition, configuring parameters for match accuracy, using opencv to draw rectangles around faces, and troubleshooting issues on ubuntu, providing a comprehensive overview of facial recognition with python and the face_recognition library.', 'The installation of the face recognition package depends on the operating system and the choice of using CUDA, leading to multiple installation paths.', 'The face recognition package involves making three main calls, with the rest being additional code around it for utilization.', 'The distinction between face detection and facial recognition is provided, along with an example of known faces and their respective identities.', 'The chapter discusses setting up a directory for known faces with identities and a directory for unknown faces, including multiple faces in images.', "Using 100 images of somebody's face with different lighting conditions is ideal for matching accuracy.", 'The lower the tolerance, the less chance of false positives, default face recognition tolerance is 0.6.', 'The higher the frame thickness, the larger the square drawn around the head, default frame thickness is three pixels.', 'The model selection between CNN and HOG impacts processing speed, with HOG likely to run better on the CPU.', 'The algorithm compares the current encoding to known faces and returns a list of Boolean values, which indicates whether a match is found.', 'The known names list contains identities corresponding to the face encodings, allowing for identification of the matched face by checking the index of the true Boolean values in the results.', 'The algorithm identifies a match by checking if there is at least one true Boolean value in the results, then retrieves the corresponding identity from the known names list.', 'The chapter discusses the process of drawing rectangles and text on an image using cv2.rectangle and cv2.putText.', 'The chapter explains the coordinates, color, and font specifications for drawing the rectangles and text.', 'The speaker mentions the potential for increased accuracy in face recognition with more examples and advises experimenting with the tolerance level to minimize false negatives, highlighting the flexibility of the face recognition system.', 'The section demonstrates fine-tuning face recognition tolerance, with examples of false positives and false negatives, showcasing the impact of setting the tolerance level at 0.3 and 0.5.', 'The chapter emphasizes displaying the title and actual image for each unknown image using CV2.', "The chapter discusses troubleshooting OpenCV issues on Ubuntu and setting time delays, such as using 'cv2.waitkey 10,000' for a 10-second delay."]}