title
Facial Recognition on Video with Python

description
Neural Networks from Scratch: https://nnfs.io Face Recognition package tutorial (part 1): 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 #python #facialrecognition #tutorial

detail
{'title': 'Facial Recognition on Video with Python', 'heatmap': [{'end': 275.069, 'start': 208.841, 'weight': 0.704}], 'summary': 'Tutorial series covers the transition from facial recognition on images to videos, implementing face recognition for video surveillance and identity verification using python, optimizing image encoding process, saving face encodings with pickle, and improving face recognition with logic and tolerance for better accuracy and robustness.', 'chapters': [{'end': 231.619, 'segs': [{'end': 175.9, 'src': 'embed', 'start': 2.208, 'weight': 0, 'content': [{'end': 5.79, 'text': "What's going on everybody and welcome to another facial recognition video.", 'start': 2.208, 'duration': 3.582}, {'end': 6.39, 'text': 'In this video.', 'start': 5.97, 'duration': 0.42}, {'end': 16.053, 'text': "what we're going to be talking about is doing facial recognition on video and then kind of expanding our logic and code a little bit from there.", 'start': 6.39, 'duration': 9.663}, {'end': 18.195, 'text': 'So just to do something a little more interesting.', 'start': 16.174, 'duration': 2.021}, {'end': 26.06, 'text': 'So where we left off, we were basically just doing this on images and we had this known faces during the unknown faces.', 'start': 18.795, 'duration': 7.265}, {'end': 33.485, 'text': 'during unknown faces is where the images were that we wanted to do facial recognition on and see if hey, do we know this face?', 'start': 26.06, 'duration': 7.425}, {'end': 38.857, 'text': 'So now we wanna use video instead of the unknown faces directory.', 'start': 34.392, 'duration': 4.465}, {'end': 41.68, 'text': "So what I'm gonna go ahead and do is just comment that out.", 'start': 38.957, 'duration': 2.723}, {'end': 44.503, 'text': "And we actually aren't gonna need the unknown faces directory anymore,", 'start': 41.7, 'duration': 2.803}, {'end': 50.889, 'text': "because really it's gonna be our video file or video source that is going to be the unknown faces.", 'start': 44.503, 'duration': 6.386}, {'end': 55.092, 'text': 'So the next thing we want to do is actually load in that video.', 'start': 51.65, 'duration': 3.442}, {'end': 63.456, 'text': "So I'm going to say video equals, whoops, I'm going to say video equals cv2.videocapture.", 'start': 55.152, 'duration': 8.304}, {'end': 67.898, 'text': "And then here, you'll specify either kind of an index number for that video.", 'start': 63.476, 'duration': 4.422}, {'end': 71.1, 'text': "So it's either video 0, 1, 2, and so on.", 'start': 68.059, 'duration': 3.041}, {'end': 74.022, 'text': "In my case, that'll be a video 2.", 'start': 71.821, 'duration': 2.201}, {'end': 78.304, 'text': 'Otherwise, you also could put in a file name here as well.', 'start': 74.022, 'duration': 4.282}, {'end': 81.265, 'text': 'And later on, we are going to use a video file.', 'start': 78.744, 'duration': 2.521}, {'end': 86.786, 'text': 'But for now, I just want to use a video feed since I think a lot of people were interested in that as well.', 'start': 81.845, 'duration': 4.941}, {'end': 88.747, 'text': 'Plus, might as well show both.', 'start': 87.826, 'duration': 0.921}, {'end': 92.087, 'text': 'So OK, so now we have our video feed.', 'start': 89.307, 'duration': 2.78}, {'end': 94.768, 'text': "We're still going to load in our known faces.", 'start': 92.748, 'duration': 2.02}, {'end': 95.408, 'text': "That's fine.", 'start': 94.808, 'duration': 0.6}, {'end': 97.509, 'text': 'And then the only other thing that really changes is here.', 'start': 95.468, 'duration': 2.041}, {'end': 102.29, 'text': "So instead of saying for file name, we're actually going to put this in a while true loop.", 'start': 98.089, 'duration': 4.201}, {'end': 106.633, 'text': "then we don't need file name anymore, we don't have.", 'start': 102.99, 'duration': 3.643}, {'end': 112.937, 'text': "the thing that's going to replace image now is going to be reading from our capture.", 'start': 106.633, 'duration': 6.304}, {'end': 121.083, 'text': "so instead we're going to say actually it's going to be Rhett and an image, and then we're going to, and that's just like return image,", 'start': 112.937, 'duration': 8.146}, {'end': 124.246, 'text': "and then it's video dot.", 'start': 121.083, 'duration': 3.163}, {'end': 124.546, 'text': 'what is it?', 'start': 124.246, 'duration': 0.3}, {'end': 125.386, 'text': 'is it capture?', 'start': 124.546, 'duration': 0.84}, {'end': 127.268, 'text': 'I think I always forget this video.', 'start': 125.386, 'duration': 1.882}, {'end': 131.035, 'text': "oh Yeah, it's right there, duh.", 'start': 127.268, 'duration': 3.767}, {'end': 144.344, 'text': "Okay, so video read now we have our image and then we do a locations encodings and in this case we're actually already using OpenCV to get the image.", 'start': 131.536, 'duration': 12.808}, {'end': 149.347, 'text': "so we don't need to do this conversion anymore, because it's already in BGR.", 'start': 144.344, 'duration': 5.003}, {'end': 155.29, 'text': 'and in theory you might need to do the conversion before the encodings, i suppose, or even locations.', 'start': 149.827, 'duration': 5.463}, {'end': 164.674, 'text': "but um, it seems to me, through playing around it, the face rec works no matter what, if you're using bgr or rgb.", 'start': 155.29, 'duration': 9.384}, {'end': 167.896, 'text': "so i don't know how big of a impact color is playing.", 'start': 164.674, 'duration': 3.222}, {'end': 172.538, 'text': 'if anything, it might, even in the back end, be converting things to grayscale, for all i know.', 'start': 167.896, 'duration': 4.642}, {'end': 173.739, 'text': 'if you know, let me know.', 'start': 172.538, 'duration': 1.201}, {'end': 175.9, 'text': "i actually do not know what they're doing yet.", 'start': 173.739, 'duration': 2.161}], 'summary': 'Facial recognition on video, using opencv to process frames, and discussing the impact of color on facial recognition.', 'duration': 173.692, 'max_score': 2.208, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs2208.jpg'}, {'end': 231.619, 'src': 'embed', 'start': 203.697, 'weight': 8, 'content': [{'end': 208.461, 'text': 'basically, if the user presses the Q key, we wanna break.', 'start': 203.697, 'duration': 4.764}, {'end': 214.906, 'text': "And then because I'm on Ubuntu, I guess destroy window is what does not work on Ubuntu.", 'start': 208.841, 'duration': 6.065}, {'end': 220.63, 'text': 'So one thing that Daniel was saying was one way around this is you can just try and accept.', 'start': 215.046, 'duration': 5.584}, {'end': 224.854, 'text': 'So you can try cv2.destroyWindow, accept, pass.', 'start': 220.67, 'duration': 4.184}, {'end': 231.619, 'text': 'And just be done there, because I guess for some reason on Ubuntu, this function just does not work.', 'start': 226.495, 'duration': 5.124}], 'summary': 'On ubuntu, pressing the q key should break; cv2.destroywindow may not work, so using try and accept may be a workaround.', 'duration': 27.922, 'max_score': 203.697, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs203697.jpg'}], 'start': 2.208, 'title': 'Facial recognition and video processing', 'summary': 'Covers the transition from facial recognition on images to videos, focusing on using video as the unknown faces, specifying video input, and exploring the impact of color on face recognition, along with addressing specific issues related to video processing.', 'chapters': [{'end': 63.456, 'start': 2.208, 'title': 'Facial recognition on video', 'summary': 'Discusses the transition from facial recognition on images to videos, removing the need for an unknown faces directory and focusing on using video as the unknown faces, emphasizing the process of loading the video for recognition.', 'duration': 61.248, 'highlights': ['The transition from facial recognition on images to videos removes the need for an unknown faces directory, focusing on using video as the unknown faces.', "The emphasis is on the process of loading the video for recognition, as indicated by the code snippet 'video equals cv2.videocapture'.", 'The video content aims to expand the logic and code for facial recognition, creating a more interesting approach.']}, {'end': 131.035, 'start': 63.476, 'title': 'Video feed processing with opencv', 'summary': "Discusses specifying video input by index number or file name, using a while true loop to read from a video feed, and replacing 'image' with 'capture' for processing.", 'duration': 67.559, 'highlights': ['The chapter discusses specifying either an index number or a file name for the video input, with the example of using video 2 as input.', 'It mentions the use of a while true loop for reading from a video feed instead of using a file name.', "The chapter explains the replacement of 'image' with 'capture' for processing the video feed."]}, {'end': 231.619, 'start': 131.536, 'title': 'Face recognition and image processing', 'summary': "Explores the impact of color on face recognition, the use of opencv for image processing, and the workaround for 'destroywindow' function not working on ubuntu.", 'duration': 100.083, 'highlights': ['The face recognition works regardless of whether BGR or RGB is used, raising questions about the impact of color on the process.', 'The use of OpenCV for image processing eliminates the need for additional conversions, streamlining the encoding process.', "The workaround for the 'destroyWindow' function not working on Ubuntu involves using the 'try and accept' approach with 'cv2.destroyWindow' to handle the issue."]}], 'duration': 229.411, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs2208.jpg', 'highlights': ['The transition from facial recognition on images to videos removes the need for an unknown faces directory, focusing on using video as the unknown faces.', "The emphasis is on the process of loading the video for recognition, as indicated by the code snippet 'video equals cv2.videocapture'.", 'The video content aims to expand the logic and code for facial recognition, creating a more interesting approach.', 'The chapter discusses specifying either an index number or a file name for the video input, with the example of using video 2 as input.', 'It mentions the use of a while true loop for reading from a video feed instead of using a file name.', "The chapter explains the replacement of 'image' with 'capture' for processing the video feed.", 'The face recognition works regardless of whether BGR or RGB is used, raising questions about the impact of color on the process.', 'The use of OpenCV for image processing eliminates the need for additional conversions, streamlining the encoding process.', "The workaround for the 'destroyWindow' function not working on Ubuntu involves using the 'try and accept' approach with 'cv2.destroyWindow' to handle the issue."]}, {'end': 518.674, 'segs': [{'end': 275.069, 'src': 'embed', 'start': 232.6, 'weight': 0, 'content': [{'end': 233.921, 'text': 'so very interesting.', 'start': 232.6, 'duration': 1.321}, {'end': 237.062, 'text': "okay with that, i think i think that's everything.", 'start': 233.921, 'duration': 3.141}, {'end': 241.644, 'text': "i've got my trusty webcam here and let's see if that works.", 'start': 237.062, 'duration': 4.582}, {'end': 243.765, 'text': "so let's pull this up.", 'start': 241.644, 'duration': 2.121}, {'end': 246.246, 'text': "here we go and what we're going to say is python.", 'start': 243.765, 'duration': 2.481}, {'end': 249.928, 'text': "i've renamed this file to be video face rack, example.pi.", 'start': 246.246, 'duration': 3.682}, {'end': 251.829, 'text': "let's go ahead and run that.", 'start': 249.928, 'duration': 1.901}, {'end': 258.733, 'text': "it's going to load in our known faces, which really is just my face, And as you can see, that works decently well.", 'start': 251.829, 'duration': 6.904}, {'end': 265.199, 'text': 'Obviously as the face starts to come up a little bit more, you start to like lose the face, but not bad.', 'start': 258.773, 'duration': 6.426}, {'end': 268.002, 'text': "Okay, so let's go ahead and press Q.", 'start': 265.58, 'duration': 2.422}, {'end': 275.069, 'text': 'And that should be everything you want for video, you know, from a video, either a video file or a video feed.', 'start': 268.002, 'duration': 7.067}], 'summary': 'Demonstrating python face recognition with webcam and video feed.', 'duration': 42.469, 'max_score': 232.6, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs232600.jpg'}, {'end': 368.93, 'src': 'embed', 'start': 339.909, 'weight': 1, 'content': [{'end': 345.172, 'text': "There's some places where you might have a bunch of employees that you expect to see commonly, but then,", 'start': 339.909, 'duration': 5.263}, {'end': 349.795, 'text': "if there's some new face that has no reason to be there commonly, you've got a problem.", 'start': 345.172, 'duration': 4.623}, {'end': 356.118, 'text': 'So these are kind of typical security issues that are faced by businesses and stuff like that.', 'start': 349.815, 'duration': 6.303}, {'end': 358.2, 'text': 'And even government buildings, kind of the same thing.', 'start': 356.219, 'duration': 1.981}, {'end': 359.941, 'text': 'So What can you do?', 'start': 358.26, 'duration': 1.681}, {'end': 362.424, 'text': 'well, using face rec, we can actually do this.', 'start': 359.941, 'duration': 2.483}, {'end': 364.226, 'text': 'quite simply, we can find out either.', 'start': 362.424, 'duration': 1.802}, {'end': 368.93, 'text': 'we can find out both of those questions who are the common people, who are the uncommon people?', 'start': 364.226, 'duration': 4.704}], 'summary': 'Using face rec to identify common and uncommon people in workplaces and government buildings to address security issues.', 'duration': 29.021, 'max_score': 339.909, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs339909.jpg'}, {'end': 462.849, 'src': 'embed', 'start': 423.83, 'weight': 3, 'content': [{'end': 427.454, 'text': 'So face, what is it? Face rec video, video.mp4.', 'start': 423.83, 'duration': 3.624}, {'end': 433.167, 'text': "So that's all you have to do because that video file is local to where I'm working.", 'start': 429.605, 'duration': 3.562}, {'end': 444.872, 'text': "The next thing is we want to actually, rather than doing really anything else, what we're trying to do is assign, um, assign IDs to, uh, to people.", 'start': 433.787, 'duration': 11.085}, {'end': 446.352, 'text': "So we don't really care about names anymore.", 'start': 444.892, 'duration': 1.46}, {'end': 447.553, 'text': "We're going to be working on IDs.", 'start': 446.372, 'duration': 1.181}, {'end': 453.3, 'text': 'later. if you wanted to actually name these individuals, you just have a dictionary that maps ids to names.', 'start': 448.075, 'duration': 5.225}, {'end': 455.162, 'text': "but that's not really what i'm going for at the moment.", 'start': 453.3, 'duration': 1.862}, {'end': 459.766, 'text': "so instead, what we're going to say is we're going to yeah, we're going to load in known faces and known names.", 'start': 455.162, 'duration': 4.604}, {'end': 462.849, 'text': "uh, the other thing we're going to do is because we're working in ids.", 'start': 459.766, 'duration': 3.083}], 'summary': 'Developing a face recognition system using ids instead of names for known faces.', 'duration': 39.019, 'max_score': 423.83, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs423830.jpg'}, {'end': 518.674, 'src': 'embed', 'start': 497.577, 'weight': 4, 'content': [{'end': 506.607, 'text': 'That way later if you are doing some debugging or something, you could see who is this person actually.', 'start': 497.577, 'duration': 9.03}, {'end': 508.228, 'text': 'Show me a face of this person.', 'start': 506.967, 'duration': 1.261}, {'end': 512.751, 'text': 'And then later you could compare that face a known database of people.', 'start': 508.328, 'duration': 4.423}, {'end': 518.674, 'text': "so again, if it's an office building or something, you've got headshots of all the individuals for their IDs, or whatever the case,", 'start': 512.751, 'duration': 5.923}], 'summary': 'Facial recognition technology can be used to identify individuals in an office building by comparing their faces to a known database of people.', 'duration': 21.097, 'max_score': 497.577, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs497577.jpg'}], 'start': 232.6, 'title': 'Face and facial recognition', 'summary': 'Discusses implementing face recognition for video surveillance and identity verification using python, with a focus on labeling and identifying common and uncommon faces in various settings, as well as assigning ids to individuals and utilizing a video file for instant identification.', 'chapters': [{'end': 359.941, 'start': 232.6, 'title': 'Face recognition for video surveillance', 'summary': 'Discusses implementing face recognition for video surveillance using python, with a focus on labeling and identifying common and uncommon faces in various settings, such as office buildings, schools, airports, and government buildings.', 'duration': 127.341, 'highlights': ['Implementing face recognition for video surveillance using Python, focusing on labeling and identifying common and uncommon faces in different settings.', 'Discussing the security implications of identifying common and uncommon faces in office buildings, schools, airports, and government buildings.', 'Demonstrating the functionality of the face recognition system through a video feed and known faces, emphasizing the potential applications in security and surveillance.']}, {'end': 518.674, 'start': 359.941, 'title': 'Facial recognition for identity verification', 'summary': 'Discusses using facial recognition for identity verification, with a focus on assigning ids to individuals and utilizing a video file to demonstrate the process, emphasizing the potential for instant identification and the capability to add an infinite number of photos for recognition.', 'duration': 158.733, 'highlights': ['The process involves using facial recognition to assign IDs to individuals, focusing on creating a clean slate and utilizing known faces and names in the system.', 'Demonstrating the capability to instantly identify uncommon individuals through face recognition, showcasing the potential for efficient identity verification.', 'Utilizing a video file to showcase the facial recognition process, highlighting the ability to add an infinite number of photos for recognition purposes and emphasizing the potential for instant identification.']}], 'duration': 286.074, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs232600.jpg', 'highlights': ['Implementing face recognition for video surveillance using Python, focusing on labeling and identifying common and uncommon faces in different settings.', 'Discussing the security implications of identifying common and uncommon faces in office buildings, schools, airports, and government buildings.', 'Demonstrating the functionality of the face recognition system through a video feed and known faces, emphasizing the potential applications in security and surveillance.', 'The process involves using facial recognition to assign IDs to individuals, focusing on creating a clean slate and utilizing known faces and names in the system.', 'Demonstrating the capability to instantly identify uncommon individuals through face recognition, showcasing the potential for efficient identity verification.', 'Utilizing a video file to showcase the facial recognition process, highlighting the ability to add an infinite number of photos for recognition purposes and emphasizing the potential for instant identification.']}, {'end': 900.65, 'segs': [{'end': 548.155, 'src': 'embed', 'start': 518.674, 'weight': 0, 'content': [{'end': 524.516, 'text': 'you can very quickly label all those individuals when necessary.', 'start': 518.674, 'duration': 5.842}, {'end': 527.277, 'text': "so we don't need the image anymore for now, though.", 'start': 524.516, 'duration': 2.761}, {'end': 532.861, 'text': "so we're gonna do that, the encoding, and instead what we're going to do now is we're going to save the encoding,", 'start': 527.277, 'duration': 5.584}, {'end': 535.204, 'text': "because again we don't care about the image so much.", 'start': 532.861, 'duration': 2.343}, {'end': 539.648, 'text': 'so having the image, then encoding the image, just kind of makes the upstart time take a while.', 'start': 535.204, 'duration': 4.444}, {'end': 542.73, 'text': "so instead what we're going to say is encoding rather than equaling,", 'start': 539.648, 'duration': 3.082}, {'end': 548.155, 'text': "that we're actually going to say encoding equals and we're going to import pickle.", 'start': 542.73, 'duration': 5.425}], 'summary': 'Quickly label individuals, save encoding, optimize processing time.', 'duration': 29.481, 'max_score': 518.674, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs518674.jpg'}, {'end': 726.821, 'src': 'embed', 'start': 661.635, 'weight': 2, 'content': [{'end': 671.099, 'text': "So if we have more than one or more, what do we want? So we're going to say the next ID that we're going to assign is equal to max known names.", 'start': 661.635, 'duration': 9.464}, {'end': 679.122, 'text': 'This will just be a list of IDs plus one and then max of known names.', 'start': 671.139, 'duration': 7.983}, {'end': 682.623, 'text': "I can't really decide if I encoding name.", 'start': 679.782, 'duration': 2.841}, {'end': 684.584, 'text': 'This might also need to be an int.', 'start': 682.883, 'duration': 1.701}, {'end': 688.6, 'text': "Now that I'm thinking about it, I think we'll do that.", 'start': 686.058, 'duration': 2.542}, {'end': 690.541, 'text': "Let's see if we get away with that.", 'start': 689.74, 'duration': 0.801}, {'end': 698.165, 'text': 'And then else, next ID will start at zero.', 'start': 691.321, 'duration': 6.844}, {'end': 703.448, 'text': "Cool So now what we're going to do is we load in.", 'start': 699.186, 'duration': 4.262}, {'end': 704.889, 'text': 'Yeah, all this stuff comes in.', 'start': 703.569, 'duration': 1.32}, {'end': 705.85, 'text': "We're iterating.", 'start': 705.109, 'duration': 0.741}, {'end': 712.274, 'text': 'And then basically the only thing that really now needs to change is if true, we made a match.', 'start': 705.87, 'duration': 6.404}, {'end': 714.978, 'text': "If we didn't, Right.", 'start': 712.954, 'duration': 2.024}, {'end': 721.34, 'text': "We're going to say else what we need to really know is, you know, what's the next ID.", 'start': 714.998, 'duration': 6.342}, {'end': 726.821, 'text': "So we're going to say match equals string next ID.", 'start': 721.4, 'duration': 5.421}], 'summary': 'Assign next id based on max known names or start at zero.', 'duration': 65.186, 'max_score': 661.635, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs661635.jpg'}, {'end': 860.022, 'src': 'embed', 'start': 814.256, 'weight': 1, 'content': [{'end': 816.818, 'text': 'But then what we need to do is known names.', 'start': 814.256, 'duration': 2.562}, {'end': 818.539, 'text': "We're going to do dot append.", 'start': 817.218, 'duration': 1.321}, {'end': 825.274, 'text': 'match not next ID otherwise we Continue raising that up.', 'start': 821.53, 'duration': 3.744}, {'end': 827.257, 'text': 'I just need a lot more coffee this morning.', 'start': 825.855, 'duration': 1.402}, {'end': 840.953, 'text': "No names and then known underscore faces dot append In this case for face, so this would be a face encoding and So we'll save those two things.", 'start': 827.817, 'duration': 13.136}, {'end': 848.496, 'text': "And then what we want to do is save now that we've got this new encoding and it's only when we have a new encoding later, you could save more.", 'start': 841.213, 'duration': 7.283}, {'end': 853.038, 'text': "And I'll talk a little bit about some of the logic I thought of to like add more faces,", 'start': 848.536, 'duration': 4.502}, {'end': 855.76, 'text': "but for now we're just going to save the first new face and coding.", 'start': 853.038, 'duration': 2.722}, {'end': 860.022, 'text': "So we're gonna say known faces, append face and coding, which also might be kind of sloppy.", 'start': 855.78, 'duration': 4.242}], 'summary': 'Adding new face encodings to known faces for recognition.', 'duration': 45.766, 'max_score': 814.256, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs814256.jpg'}, {'end': 909.558, 'src': 'embed', 'start': 880.172, 'weight': 5, 'content': [{'end': 888.939, 'text': 'I did ask, so people had a good point about the backslash, but does not, I always thought the forward slash still worked in Python for me on Windows.', 'start': 880.172, 'duration': 8.767}, {'end': 893.944, 'text': "Like if I was giving forward slash file names, I'll have to go back to Windows and see if I'm incorrect there.", 'start': 888.979, 'duration': 4.965}, {'end': 897.787, 'text': "But anyway, if you're on Windows, I guess use the backslash.", 'start': 894.024, 'duration': 3.763}, {'end': 898.188, 'text': "I don't know.", 'start': 897.887, 'duration': 0.301}, {'end': 900.65, 'text': 'And actually it would be the double backslash.', 'start': 898.708, 'duration': 1.942}, {'end': 909.558, 'text': 'Okay, known faces dir slash os.make dir, and then we have a new index, which is gonna be the match.', 'start': 901.769, 'duration': 7.789}], 'summary': 'In python, use double backslash for file paths on windows.', 'duration': 29.386, 'max_score': 880.172, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs880172.jpg'}], 'start': 518.674, 'title': 'Optimizing image encoding process', 'summary': 'Discusses the use of pickle for image encoding, leading to faster startup time and efficient labeling, and troubleshooting and refactoring face recognition code including appending face encodings, saving new encodings, and using f strings for file paths.', 'chapters': [{'end': 755.073, 'start': 518.674, 'title': 'Optimizing image encoding process', 'summary': 'Discusses optimizing the image encoding process by saving the encoding using pickle instead of encoding the image, resulting in a faster startup time and efficient labeling of individuals.', 'duration': 236.399, 'highlights': ['The encoding process is optimized by saving the encoding using pickle instead of encoding the image, resulting in a faster startup time and efficient labeling of individuals.', 'The next ID to be assigned is determined based on the maximum of known names plus one, or zero if the list is empty, ensuring unique identification for individuals.', 'The process also includes iterating through the data and determining the next ID to be assigned for efficient management of IDs and ensuring unique identification for individuals.']}, {'end': 900.65, 'start': 755.694, 'title': 'Troubleshooting and refactoring code', 'summary': 'Discusses troubleshooting and refactoring the code for face recognition, including appending face encodings, saving new encodings, and using f strings for file paths.', 'duration': 144.956, 'highlights': ['The chapter emphasizes the need to append known names and known faces for each new face encoding to prevent constant new IDs for each face.', 'The speaker discusses the importance of saving the first new face encoding and suggests waiting a bit before saving to ensure accurate encoding.', 'The chapter mentions using F strings for file paths and the consideration of using backslashes for Windows compatibility.']}], 'duration': 381.976, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs518674.jpg', 'highlights': ['The encoding process is optimized by saving the encoding using pickle instead of encoding the image, resulting in a faster startup time and efficient labeling of individuals.', 'The chapter emphasizes the need to append known names and known faces for each new face encoding to prevent constant new IDs for each face.', 'The next ID to be assigned is determined based on the maximum of known names plus one, or zero if the list is empty, ensuring unique identification for individuals.', 'The process also includes iterating through the data and determining the next ID to be assigned for efficient management of IDs and ensuring unique identification for individuals.', 'The speaker discusses the importance of saving the first new face encoding and suggests waiting a bit before saving to ensure accurate encoding.', 'The chapter mentions using F strings for file paths and the consideration of using backslashes for Windows compatibility.']}, {'end': 1190.25, 'segs': [{'end': 929.662, 'src': 'embed', 'start': 901.769, 'weight': 2, 'content': [{'end': 909.558, 'text': 'Okay, known faces dir slash os.make dir, and then we have a new index, which is gonna be the match.', 'start': 901.769, 'duration': 7.789}, {'end': 915.986, 'text': 'So we make that directory, and now what we wanna do is actually save that encoding.', 'start': 910.299, 'duration': 5.687}, {'end': 919.57, 'text': 'So that would be pickle.dump, and then.', 'start': 916.046, 'duration': 3.524}, {'end': 925.02, 'text': "we will say, it's like, this is a perfect example of why I like kite.", 'start': 921.638, 'duration': 3.382}, {'end': 927.401, 'text': "So now it's not there for me.", 'start': 926.04, 'duration': 1.361}, {'end': 928.342, 'text': 'There we go.', 'start': 927.421, 'duration': 0.921}, {'end': 929.662, 'text': 'I always forget the order.', 'start': 928.582, 'duration': 1.08}], 'summary': 'Using os.make dir to create new directory and pickle.dump to save encoding.', 'duration': 27.893, 'max_score': 901.769, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs901769.jpg'}, {'end': 1039.916, 'src': 'embed', 'start': 982.096, 'weight': 3, 'content': [{'end': 989.161, 'text': "you really could, like you could say match, dot, pkl, and then what we'll say is wb.", 'start': 982.096, 'duration': 7.065}, {'end': 993.325, 'text': 'but I think what I want to do is prepare us for the possibility later of saving multiple encodings.', 'start': 989.161, 'duration': 4.164}, {'end': 998.709, 'text': "so what I'm going to do instead is we're going to import time and then we're going to come down here, match,", 'start': 993.325, 'duration': 5.384}, {'end': 1004.533, 'text': "and I'm going to say dash the int value of time, dot time.", 'start': 998.709, 'duration': 5.824}, {'end': 1007.278, 'text': 'Cool. so really long file name.', 'start': 1005.657, 'duration': 1.621}, {'end': 1010.721, 'text': "but basically all we're doing is we're just saving the match and the time of when.", 'start': 1007.278, 'duration': 3.443}, {'end': 1012.923, 'text': 'So the match is encoding and when was that.', 'start': 1010.761, 'duration': 2.162}, {'end': 1013.984, 'text': "And that's it.", 'start': 1013.583, 'duration': 0.401}, {'end': 1017.566, 'text': "So okay, so we've got all that, pickle dump.", 'start': 1014.604, 'duration': 2.962}, {'end': 1024.551, 'text': "So now we have saved that, we've appended it, and I think we're ready.", 'start': 1018.347, 'duration': 6.204}, {'end': 1027.273, 'text': "Let's try again.", 'start': 1026.553, 'duration': 0.72}, {'end': 1030.916, 'text': 'We can either review our code or just run it and fix the errors as they come.', 'start': 1027.714, 'duration': 3.202}, {'end': 1039.916, 'text': 'Okay, this time, okay, so Obama is ID 0.', 'start': 1036.214, 'duration': 3.702}], 'summary': 'Saving match and time encoding for multiple encodings.', 'duration': 57.82, 'max_score': 982.096, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs982096.jpg'}, {'end': 1085.266, 'src': 'embed', 'start': 1059.893, 'weight': 0, 'content': [{'end': 1065.141, 'text': "So now you can see even here, Obama is mostly zero, but sometimes he's getting a five.", 'start': 1059.893, 'duration': 5.248}, {'end': 1068.447, 'text': "Trump is mostly three now, but he's also a four.", 'start': 1065.462, 'duration': 2.985}, {'end': 1071.632, 'text': 'This is clearly Obama again, ID is zero.', 'start': 1069.368, 'duration': 2.264}, {'end': 1077.041, 'text': "And then I'm trying to think who else we're okay.", 'start': 1075.02, 'duration': 2.021}, {'end': 1081.684, 'text': "We're still got a Biden coming in and then we still have a Musk coming in.", 'start': 1077.081, 'duration': 4.603}, {'end': 1083.705, 'text': 'So most of these are pretty good faces.', 'start': 1081.844, 'duration': 1.861}, {'end': 1085.266, 'text': "So I guess they're getting a good thing.", 'start': 1083.745, 'duration': 1.521}], 'summary': 'Facial recognition rates obama as mostly zero and trump as mostly three, with occasional higher scores.', 'duration': 25.373, 'max_score': 1059.893, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs1059893.jpg'}, {'end': 1190.25, 'src': 'embed', 'start': 1135.65, 'weight': 1, 'content': [{'end': 1139.351, 'text': 'So make it a little more tolerant at recognize, because look at this, we got 17 IDs.', 'start': 1135.65, 'duration': 3.701}, {'end': 1140.171, 'text': "Let's close that.", 'start': 1139.411, 'duration': 0.76}, {'end': 1152.72, 'text': 'So one option we have is you could, you can either increase or decrease the tolerance.', 'start': 1140.191, 'duration': 12.529}, {'end': 1156.181, 'text': 'So let me run this while I explain.', 'start': 1153.2, 'duration': 2.981}, {'end': 1162.043, 'text': 'So one option we have is to have a pretty open tolerance.', 'start': 1157.141, 'duration': 4.902}, {'end': 1166.404, 'text': "So let's just see how much this changes, how many IDs we wind up getting.", 'start': 1162.623, 'duration': 3.781}, {'end': 1168.325, 'text': 'Let me see if this actually is popping up.', 'start': 1166.424, 'duration': 1.901}, {'end': 1173.666, 'text': 'At risk of pulling up OBS, an infinite thing.', 'start': 1168.705, 'duration': 4.961}, {'end': 1174.126, 'text': 'No, cool.', 'start': 1173.726, 'duration': 0.4}, {'end': 1179.488, 'text': "So, okay, so so far we just have the two, oh wait, you can't even see it.", 'start': 1174.606, 'duration': 4.882}, {'end': 1180.724, 'text': 'the two IDs.', 'start': 1179.844, 'duration': 0.88}, {'end': 1182.145, 'text': "Now, can you see it? Let's see.", 'start': 1180.865, 'duration': 1.28}, {'end': 1184.947, 'text': 'Yeah So we just have the two IDs.', 'start': 1182.365, 'duration': 2.582}, {'end': 1187.648, 'text': "It seems to be doing a little better at least, so that's good.", 'start': 1184.987, 'duration': 2.661}, {'end': 1190.25, 'text': 'But we actually got a few new ones.', 'start': 1188.629, 'duration': 1.621}], 'summary': 'The process resulted in obtaining 17 ids, with the option to adjust tolerance for better results.', 'duration': 54.6, 'max_score': 1135.65, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs1135650.jpg'}], 'start': 901.769, 'title': 'Saving face encodings with pickle and facial recognition analysis', 'summary': 'Demonstrates saving face encodings with pickle and discusses facial recognition analysis involving obama, trump, elon musk, and biden, highlighting adjustments in tolerance levels and resulting in varying numbers of ids identified.', 'chapters': [{'end': 1039.916, 'start': 901.769, 'title': 'Saving face encodings with pickle', 'summary': "Demonstrates the process of saving face encodings using pickle, with a mention of using kite for auto-completion and importing time for timestamp, and concludes with the successful saving of the face encodings of 'obama' as id 0.", 'duration': 138.147, 'highlights': ['The process of saving face encodings using pickle is demonstrated, with a mention of using kite for auto-completion.', 'Importing time for timestamp is discussed in preparation for saving multiple encodings in the future.', "The successful saving of the face encodings of 'Obama' as ID 0 is mentioned."]}, {'end': 1190.25, 'start': 1039.916, 'title': 'Facial recognition analysis', 'summary': 'Explores the process of facial recognition involving individuals like obama, trump, elon musk, and biden, and discusses the adjustments made in the tolerance levels, resulting in varying numbers of ids identified.', 'duration': 150.334, 'highlights': ['The facial recognition analysis involves individuals like Obama, Trump, Elon Musk, and Biden, with varying IDs assigned to them.', 'The discussion includes making adjustments in tolerance levels, such as increasing it from 0.5 to 0.6, resulting in the identification of 17 IDs.', 'The speaker notes the need to be cautious of potential technical issues, such as the risk of unintended infinite loops when running the program.']}], 'duration': 288.481, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs901769.jpg', 'highlights': ['Facial recognition analysis involves Obama, Trump, Elon Musk, and Biden with varying IDs.', 'Adjustments in tolerance levels result in varying numbers of IDs identified.', 'Demonstrates saving face encodings using pickle and mentions using kite for auto-completion.', 'Importing time for timestamp is discussed in preparation for saving multiple encodings in the future.', "Successful saving of face encodings of 'Obama' as ID 0 is mentioned.", 'Increasing tolerance level from 0.5 to 0.6 results in the identification of 17 IDs.', 'Cautions about potential technical issues, such as unintended infinite loops, are noted.']}, {'end': 1499.071, 'segs': [{'end': 1264.603, 'src': 'embed', 'start': 1235.613, 'weight': 0, 'content': [{'end': 1239.318, 'text': 'So anyway, one option we have is you could actually set the tolerance quite low.', 'start': 1235.613, 'duration': 3.705}, {'end': 1243.767, 'text': 'and then have knowledge that these IDs should not be changing as time goes on.', 'start': 1239.844, 'duration': 3.923}, {'end': 1252.013, 'text': 'And then every time you see a new face or a new version of the face also, just as note with the tolerance at 0.6,', 'start': 1244.367, 'duration': 7.646}, {'end': 1255.236, 'text': "we can see we're having really no trouble identifying either of these people.", 'start': 1252.013, 'duration': 3.223}, {'end': 1259.639, 'text': 'as that well, Biden bounced around a little bit, but at least did a better job.', 'start': 1255.236, 'duration': 4.403}, {'end': 1261.821, 'text': 'And same thing here.', 'start': 1261.12, 'duration': 0.701}, {'end': 1264.603, 'text': 'So I think before we had 17 total IDs.', 'start': 1261.881, 'duration': 2.722}], 'summary': 'Setting tolerance at 0.6 resulted in easy identification of 17 total ids.', 'duration': 28.99, 'max_score': 1235.613, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs1235613.jpg'}, {'end': 1374.331, 'src': 'embed', 'start': 1344.693, 'weight': 1, 'content': [{'end': 1347.175, 'text': 'So then what you could do is you could merge those two.', 'start': 1344.693, 'duration': 2.482}, {'end': 1351.338, 'text': "So, anytime you've got IDs bouncing around like we've just seen.", 'start': 1347.535, 'duration': 3.803}, {'end': 1360.244, 'text': 'what you could do is you could, through logic, you could say hey, that was always the same face, which one of these faces is the more common face?', 'start': 1351.338, 'duration': 8.906}, {'end': 1362.005, 'text': "and like hey, let's make that the main ID.", 'start': 1360.244, 'duration': 1.761}, {'end': 1366.008, 'text': "But what we'll do is we'll add one more face encoding to that face.", 'start': 1362.065, 'duration': 3.943}, {'end': 1367.589, 'text': 'So we can just merge the two together.', 'start': 1366.048, 'duration': 1.541}, {'end': 1374.331, 'text': 'So I think using some pretty simple logic and maybe if you guys are interested in that part three could be me doing that.', 'start': 1368.149, 'duration': 6.182}], 'summary': 'Merge and add face encoding to unify ids, using logic and simple process.', 'duration': 29.638, 'max_score': 1344.693, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs1344693.jpg'}], 'start': 1190.29, 'title': 'Improving face recognition with logic and tolerance', 'summary': 'Discusses utilizing logic and tolerance to improve face recognition, reducing total ids from 17 to 9 and considering merging ids for the same face, aiming for better accuracy and robustness over time.', 'chapters': [{'end': 1499.071, 'start': 1190.29, 'title': 'Improving face recognition with logic and tolerance', 'summary': 'Discusses utilizing logic and tolerance to improve face recognition, reducing total ids from 17 to 9 and considering the possibility of merging ids for the same face, aiming for better accuracy and robustness over time.', 'duration': 308.781, 'highlights': ['Utilizing logic and tolerance to improve face recognition, reducing total IDs from 17 to 9.', 'Considering the possibility of merging IDs for the same face to improve accuracy and robustness over time.', 'Suggesting the use of two tolerances and merging certain IDs based on logic and frame analysis.', 'Promoting a book on neural networks from scratch, emphasizing the challenges of real-world problems and the need for in-depth understanding.']}], 'duration': 308.781, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/PdkPI92KSIs/pics/PdkPI92KSIs1190290.jpg', 'highlights': ['Utilizing logic and tolerance to improve face recognition, reducing total IDs from 17 to 9.', 'Considering the possibility of merging IDs for the same face to improve accuracy and robustness over time.', 'Suggesting the use of two tolerances and merging certain IDs based on logic and frame analysis.']}], 'highlights': ['The transition from facial recognition on images to videos removes the need for an unknown faces directory, focusing on using video as the unknown faces.', "The emphasis is on the process of loading the video for recognition, as indicated by the code snippet 'video equals cv2.videocapture'.", 'The video content aims to expand the logic and code for facial recognition, creating a more interesting approach.', 'Implementing face recognition for video surveillance using Python, focusing on labeling and identifying common and uncommon faces in different settings.', 'The encoding process is optimized by saving the encoding using pickle instead of encoding the image, resulting in a faster startup time and efficient labeling of individuals.', 'Facial recognition analysis involves Obama, Trump, Elon Musk, and Biden with varying IDs.', 'Utilizing logic and tolerance to improve face recognition, reducing total IDs from 17 to 9.']}