Latest / CyberSecurity Summary / Python Image Processing Cookbook: Over 60 recipes to help you perform complex image processing and computer vision tasks with ease
Transcript
- 0:00Speaker 1: Welcome to the deep dive. Today, we're jumping into the
- 0:05Speaker 1: really interesting world of Python image processing.
- 0:08Speaker 2: Yeah, it's a big topic, it is.
- 0:10Speaker 1: And you asked us for a way to quickly get
- 0:12Speaker 1: the main ideas the techniques for manipulating and understanding images.
- 0:16Speaker 1: So that's what we're doing today.
- 0:19Speaker 2: That's a plan. We're using the Python Image Processing Cookbook
- 0:23Speaker 2: as well. Our guide is packed with practical stuff, right.
- 0:26Speaker 1: Think of it as decoding how computers learn to see
- 0:32Speaker 1: and even change the images we look at.
- 0:33Speaker 2: Every day exactly. Our goal, our mission, if you like,
- 0:36Speaker 2: is to pull out the most useful, maybe even surprising
- 0:40Speaker 2: bits from the cookbook.
- 0:41Speaker 1: Yeah, give you that shortcut to the core concepts without
- 0:43Speaker 1: getting liced in all the super technical code details right away.
- 0:47Speaker 1: We're aiming for those aha moments, Ready to dive in.
- 0:50Speaker 2: Let's do it. A really fun place to begin is
- 0:52Speaker 2: creating artistic effects. The cookbook shows some well pretty cool
- 0:56Speaker 2: ways to take a normal photo and make it something
- 0:58Speaker 2: else entirely.
- 0:59Speaker 1: Okay, I like this one of that?
- 1:00Speaker 2: Like what well one is turning photos into cartoons? Oh yeah,
- 1:03Speaker 2: not just a simple filter, I guess no, No, it's
- 1:06Speaker 2: more involved a sequence of steps.
- 1:08Speaker 1: Actually, all right, walk me through it. How do you
- 1:10Speaker 1: start making a photo look like a cartoon?
- 1:12Speaker 2: First step is something called bilateral filtering. Imagine you want
- 1:16Speaker 2: to smooth out parts of an image, but not the
- 1:19Speaker 2: sharp lines, the edges. Okay, Bilateral filtering does that. It
- 1:22Speaker 2: smooths areas with similar colors, but keeps the important boundaries sharp.
- 1:27Speaker 2: You'd use the bilateral filter function in open CD Python
- 1:31Speaker 2: for this.
- 1:31Speaker 1: Uh. Okay, so soften the texture, keep the lines, got it.
- 1:35Speaker 2: What's next then comes median blurring. This is more about
- 1:39Speaker 2: smoothing out noise and creating those flat blocks of color
- 1:42Speaker 2: you see in cartoons.
- 1:43Speaker 1: Right, like simplifying the textures exactly.
- 1:46Speaker 2: The function for that is median blur. It sort of
- 1:48Speaker 2: averages out small imperfections.
- 1:50Speaker 1: Makes sense. Flat colors, sharp lines, so the lines need
- 1:53Speaker 1: to be emphasized.
- 1:54Speaker 2: Somehow, you got it. That's where adaptive thresholding comes in.
- 1:58Speaker 2: This really makes the main edges pop. Think of it
- 2:00Speaker 2: like inking in the outlines. Okay, even if the lighting
- 2:03Speaker 2: isn't perfect across the image, adaptive threshold helps find and
- 2:07Speaker 2: enhance those dominant edges.
- 2:09Speaker 1: Nice bold outlines, flat colors. How do they merge?
- 2:13Speaker 2: The final step uses a bit wise A and D operation.
- 2:18Speaker 2: Imagine you have the smooth color image on one layer
- 2:21Speaker 2: and the strong edges on another. The bitwise and function
- 2:24Speaker 2: basically combines them, so the color fills in up to
- 2:27Speaker 2: those strong edges. That gives you the final cartoon look.
- 2:31Speaker 1: That's actually really clever. It's like a recipe for mimicking
- 2:33Speaker 1: an art style. What other artistic tricks are in there?
- 2:36Speaker 2: There's also simulating light art or long exposure effects. You
- 2:40Speaker 2: know those photos with light trails from cars or water
- 2:42Speaker 2: that looks all smooth and silky.
- 2:44Speaker 1: Oh yeah, those are cool. How's that done?
- 2:46Speaker 2: It's surprisingly simple at its core. You just average together
- 2:49Speaker 2: many frames from a video clip, average them. Yeah, anything
- 2:53Speaker 2: static in the video stays clear when you average the frames,
- 2:56Speaker 2: but anything moving gets blurred together. That's how you get
- 2:58Speaker 2: the light trails or the smooth water.
- 3:00Speaker 1: Ah. Right, So if you film traffic at night, the
- 3:03Speaker 1: buildings would be sharp, but the headlights would become streaks
- 3:07Speaker 1: across the image, like leaving the camera shutter.
- 3:09Speaker 2: Open, precisely the digital equivalent. The cookbook mentions getting that
- 3:14Speaker 2: silky water look this way.
- 3:15Speaker 1: Clever, very clever. Yeah, what about drawing style like pencil sketches?
- 3:19Speaker 2: Yep? The cookbook covers that too. It uses different kinds
- 3:22Speaker 2: of edge detection to pull up the outlines of details,
- 3:25Speaker 2: kind of like an artist would.
- 3:26Speaker 1: Edge detection finding the sharp changes in brightness. Right.
- 3:29Speaker 2: Yeah.
- 3:29Speaker 1: The book mentioned a few ways for sketches.
- 3:31Speaker 2: Exactly. One is using difference of Gaushian dolldy.
- 3:35Speaker 1: Og doheg dot og okay.
- 3:37Speaker 2: Yeah. The idea is you blur the image slightly differently
- 3:39Speaker 2: twice and then compare them. The differences highlight the edges.
- 3:43Speaker 2: Xog is just a variation on that, maybe for a
- 3:45Speaker 2: more stylized look.
- 3:47Speaker 1: So the computer compares slightly different views to find the
- 3:50Speaker 1: important lines. Interesting. It also mentioned anisopropic diffusion. Again we
- 3:54Speaker 1: heard that from noise reduction.
- 3:55Speaker 2: Yes, it's versatile for sketching. It smooths out the image
- 3:59Speaker 2: while keeping the key edges sharp. It simplifies things, makes
- 4:02Speaker 2: it look more abstract, more like a sketch. The book
- 4:05Speaker 2: even gives some parameters like KAPA, twenty night or twenty
- 4:09Speaker 2: as starting points, so.
- 4:10Speaker 1: It's a smart smoothing that knows what to keep. And
- 4:12Speaker 1: the last sketch method was the dodge operation.
- 4:16Speaker 2: Sounds like photography, it's related for sketching, you invert the image,
- 4:20Speaker 2: blur the inverted version quite a bit, and then sort
- 4:23Speaker 2: of divide the original by that blurred in version, sometimes
- 4:26Speaker 2: with the threshold too. It really emphasizes contrast along edges,
- 4:30Speaker 2: giving that bright outline sketch effect.
- 4:32Speaker 1: It's amazing how math can replicate these artistic looks. Okay,
- 4:36Speaker 1: So moving from art, the cookbook gets into image enhancement,
- 4:40Speaker 1: making images better, clearer, right.
- 4:42Speaker 2: And a big part of that is denoising. We all
- 4:45Speaker 2: hate grainy photos. Simple filters are the first thing mentioned,
- 4:48Speaker 2: Like blurring right that that can kill details too exactly.
- 4:52Speaker 1: Things like Gaushian or Median blur reduce noise, but they
- 4:55Speaker 1: often blur everything else.
- 4:56Speaker 2: Along with it, which brings us back to things like
- 4:59Speaker 2: anisotropic fusion.
- 5:00Speaker 1: Seems useful it really is, because it smooths while trying
- 5:04Speaker 1: to preserve edges. It's often better at removing noise without
- 5:07Speaker 1: making the whole image look soft.
- 5:09Speaker 2: Okay, And then there are denoising auto encoders. Now that
- 5:12Speaker 2: sounds like AI. It is. It's a neural network. You
- 5:15Speaker 2: train it by feeding it noisy images and teaching it
- 5:18Speaker 2: to output clean versions.
- 5:20Speaker 1: How does it learn that?
- 5:21Speaker 2: Through training lots of examples? It sees a noisy input,
- 5:25Speaker 2: makes a guess at the clean output, compares it to
- 5:27Speaker 2: the actual clean image, and adjusts itself to get closer.
- 5:30Speaker 2: Next time, it learns to recognize noise patterns and remove them.
- 5:33Speaker 2: The book even mentions you can use color images and
- 5:36Speaker 2: try different network types.
- 5:37Speaker 1: Wow, so the network literally learns what noise is and
- 5:40Speaker 1: how to subtract it. Okay, what else for enhancement? Histogram
- 5:45Speaker 1: matching sounds like adjusting brightness and contrast.
- 5:48Speaker 2: Kind of a histogram shows a distribution of brightness levels.
- 5:52Speaker 2: Histogram matching lets you take the overall tonal feel of
- 5:55Speaker 2: one image, the template, and apply it to another image,
- 5:58Speaker 2: the sourcewulate these things called cumulative distribution functions CDFs for
- 6:03Speaker 2: both images. They summarize the brightness distribution. Then you map
- 6:07Speaker 2: the brightness levels from the source image to the corresponding
- 6:10Speaker 2: levels and the template based on these CDFs.
- 6:12Speaker 1: And why would you do that?
- 6:13Speaker 2: For creative effects? Mostly the cookbook suggests making a daytime
- 6:17Speaker 2: photo look like night vision by matching its histogram to
- 6:20Speaker 2: a picture taken at night.
- 6:22Speaker 1: Huh. So you could completely change the mood by borrowing
- 6:25Speaker 1: the tonal range.
- 6:26Speaker 2: That's powerful, definitely, And the last enhancement technique here is
- 6:30Speaker 2: seamless cloning or Poisson image editing. This is about pasting
- 6:35Speaker 2: something from one image into another really realistically.
- 6:38Speaker 1: Ah yes, cutting and pasting without it looking fake. How
- 6:41Speaker 1: does that work?
- 6:41Speaker 2: The magic is in the blending. It looks at the
- 6:43Speaker 2: gradients the changes in color at the boundary of the
- 6:46Speaker 2: object you're pasting, okay, and it tries to adjust the
- 6:49Speaker 2: pasted objects so it's gradients smoothly transition into the gradients
- 6:53Speaker 2: of the background image. THECV two dot seamless clone function
- 6:56Speaker 2: in OpenCV maybe with the CV two dot mix clone
- 7:00Speaker 2: option uses some clever math Posson equations to figure this out.
- 7:04Speaker 1: So it's matching not just the colors, but the way
- 7:05Speaker 1: light and shadow change across the boundary.
- 7:07Speaker 2: Very cool exactly now. After enhancing images, the book moves
- 7:12Speaker 2: into understanding their structure, starting with edge detection algorithms. We
- 7:17Speaker 2: mentioned some for sketching, but there's more.
- 7:18Speaker 1: Right, we talked about canny and more Hildreth. For canny,
- 7:22Speaker 1: the book said, less blur means more detail, maybe more
- 7:25Speaker 1: noise and more blur gives cleaner, stronger edges.
- 7:28Speaker 2: Correct that blur amount. The sigma value controls the trade
- 7:31Speaker 2: off and mare Hildreth uses the laplation of Gaussian log filter.
- 7:36Speaker 2: It highlights rapid intensity changes. Then you find the zero
- 7:39Speaker 2: crossings in that filtered image, which often mark the edges.
- 7:43Speaker 1: Zero crossings where the filtered value goes from positive to
- 7:46Speaker 1: negative vice versa.
- 7:47Speaker 2: Yeah, it pinpoints those sharp transitions. And the third method
- 7:51Speaker 2: mentioned was wavelet based edge detection. I know wavelets from audio?
- 7:56Speaker 2: How do they work for images? Similar idea? Actually, wavelets
- 8:00Speaker 2: break down the image into different frequency components. Edges are
- 8:03Speaker 2: sharp features, so they contain a lot of high frequency information.
- 8:06Speaker 2: By looking at the wavelet coefficients the numbers representing these frequencies,
- 8:10Speaker 2: you can find where the high frequencies are concentrated, and
- 8:12Speaker 2: that tells you where the edges are. It's another way
- 8:14Speaker 2: to find.
- 8:14Speaker 1: Sharpness analyzing the image's visual frequencies. Need perspective, okay. Next
- 8:20Speaker 1: up image restoration, fixing broken images exactly.
- 8:25Speaker 2: De blurring is a big one. The cookbook mentions Wiener filters.
- 8:29Speaker 1: I think I've heard of those for signal processing YEP.
- 8:32Speaker 2: Applied to images. Wiener filters try to reverse blurring. They
- 8:36Speaker 2: estimate the original sharp image considering both how it was
- 8:38Speaker 2: blurred and any noise present. There's usually a parameter to
- 8:42Speaker 2: balance how much denoising versus de blurring.
- 8:44Speaker 1: You want a balancing act right, trying to unblur without
- 8:47Speaker 1: making noise worse. The book also mentioned constrained least squares
- 8:51Speaker 1: filtering CLS with laplation. Constrained sounds complicated.
- 8:57Speaker 2: It's a bit more advanced. CLS. Lets you add us
- 8:59Speaker 2: some about the original image. Using a laplation constraint basically
- 9:03Speaker 2: tells the algorithm the original image was probably smooth, so
- 9:07Speaker 2: try to make the deep blurred result smooth too, while
- 9:09Speaker 2: still trying to recover detail.
- 9:11Speaker 1: Got it? Adding some prior knowledge. What about denoising with
- 9:14Speaker 1: markoff random fields MRFs sounds statistical.
- 9:18Speaker 2: It is MRF's model how pixels relate to their neighbors.
- 9:21Speaker 2: The basic ideas that nearby pixels usually have similar values
- 9:24Speaker 2: in a clean image, So the algorithm tries to find
- 9:27Speaker 2: a denoised image where these local relationships are most likely,
- 9:30Speaker 2: effectively smoothing out the random noise that violates those neighborhood similarities.
- 9:35Speaker 2: The book mentions converting pixels to Mannix one and one first,
- 9:39Speaker 2: which is common for some MRF methods.
- 9:41Speaker 1: So finding the most probable clean image based on pixel statistics. Okay,
- 9:46Speaker 1: and fixing holes image in painting.
- 9:48Speaker 2: Yeah, like digital art restoration, filling in missing bits plausibly
- 9:54Speaker 2: total variation in painting is one method mentioned.
- 9:56Speaker 1: Coldal variation heard that before. How does it fill holes?
- 9:59Speaker 2: It tries to fill the missing area by extending information
- 10:02Speaker 2: from the surrounding pixels, but it does it in a
- 10:05Speaker 2: way that keeps the filled area as smooth as possible,
- 10:07Speaker 2: minimizing sharp changes or new edges within the patch. OpenCV
- 10:11Speaker 2: has functions for this.
- 10:12Speaker 1: Smoothly propagating the existing textures into the gap. Okay, And
- 10:16Speaker 1: the last restoration.
- 10:17Speaker 2: Technique, dictionary learning sounds like building a library. That's a
- 10:21Speaker 2: good analogy. You learn a set of basic image patches
- 10:24Speaker 2: the dictionary from the image itself. Then you assume that
- 10:27Speaker 2: any noisy or missing part of the image can be
- 10:30Speaker 2: reconstructed by combining these learned dictionary atoms or patches. So
- 10:34Speaker 2: you find the best combination to represent and rebuild the
- 10:37Speaker 2: damaged area.
- 10:38Speaker 1: So it learns the image's own building blocks and uses
- 10:41Speaker 1: them for repairs. Clever.
- 10:44Speaker 2: Very Okay, Moving onto binary image processing just black and white.
- 10:48Speaker 1: Pixels still useful stuff you can do though, like the
- 10:51Speaker 1: distance transform. What's that measure?
- 10:53Speaker 2: For every white pixel, it calculates how far it is
- 10:56Speaker 2: from the nearest black pixel the background boundary. Pixels deep
- 10:59Speaker 2: inside to white shape get high values, Pixels near the
- 11:02Speaker 2: edge get low values. Good for analyzing thickness or shape.
- 11:06Speaker 1: Makes sense, sort of thickness map. What about the morphological.
- 11:09Speaker 2: Gradient that's mainly for highlighting the boundaries of objects in
- 11:13Speaker 2: a binary image. You get it by subtracting an eroded
- 11:16Speaker 2: version shrunk of the image from a dilated version expanded.
- 11:20Speaker 2: It leaves just the one pixel thick outline.
- 11:22Speaker 1: A clean way to get just the edges and the
- 11:25Speaker 1: hit or mistransform. Taking name it is.
- 11:27Speaker 2: It's for finding very specific small shapes or patterns. You
- 11:30Speaker 2: use two little templates, one matching the foreground pattern and
- 11:34Speaker 2: one matching the required background around it. It only triggers
- 11:38Speaker 2: where both match perfectly.
- 11:40Speaker 1: A very precise pattern finder for binary images. Got it?
- 11:44Speaker 1: Last one here is morphological watershed, I know watershed for
- 11:48Speaker 1: segmenting grayscale images.
- 11:49Speaker 2: Yep, same principle, powerful for binary and grayscale. You treat
- 11:53Speaker 2: the image like a three D landscape based on intensity.
- 11:56Speaker 2: Then you flood it from low points the markers where
- 11:59Speaker 2: the water from different basins meats. Those are your segmentation boundaries.
- 12:03Speaker 1: Okay.
- 12:03Speaker 2: The cookbook says you can place markers by finding peaks
- 12:06Speaker 2: in the distance transform image or in low gradient areas.
- 12:10Speaker 2: Great for separating touching objects like cells, or just finding
- 12:13Speaker 2: distinct blobs flooding.
- 12:15Speaker 1: The image landscape to find the natural divides. All right,
- 12:18Speaker 1: let's shift to image registration. Aligning images super.
- 12:22Speaker 2: Important for comparing images taken at different times or with
- 12:24Speaker 2: different cameras or different medical scanners. The book starts with
- 12:28Speaker 2: medical image registration using simple ITK.
- 12:31Speaker 1: Yeah, like aligning a CT and an MRI scan of
- 12:33Speaker 1: the same patient. Right, how does simple ITK do it?
- 12:36Speaker 2: It finds the best geometric transformation maybe shifting, rotating scaling
- 12:40Speaker 2: to line them up. It does this by optimizing a
- 12:43Speaker 2: similarity score like Matt's mutual information, using a specific transform
- 12:47Speaker 2: model like similarity d transform and an optimizer maybe gradient
- 12:51Speaker 2: to set read images, set up the process run it
- 12:54Speaker 2: then resample one image to match the other.
- 12:57Speaker 1: A systematic way to find the perfect overlap. Okay. Then
- 13:00Speaker 1: there's the ECC algorithm and warping.
- 13:02Speaker 2: ECC is enhanced correlation coefficient. It's an algorithm designed to
- 13:07Speaker 2: figure out the geometric warp needed to align two images,
- 13:10Speaker 2: maybe correcting for slight camera shifts. Once you have the warp,
- 13:13Speaker 2: you apply it.
- 13:14Speaker 1: Gotcha. What about faces? Aligning faces with dlib.
- 13:17Speaker 2: Dlib is great for finding facial landmarks eyes, nose corners,
- 13:20Speaker 2: mouth corners, et cetera. Right, once you have those points
- 13:23Speaker 2: on two faces, you can calculate and a fine transformation
- 13:26Speaker 2: to warp one face so its landmarks line up with
- 13:28Speaker 2: the other. This normalizes the pose the face a laner
- 13:31Speaker 2: class and Immutell's helps here central.
- 13:34Speaker 1: For face recognition. I bet okay. Robust matching and homography
- 13:38Speaker 1: with RANSACK sounds like dealing with.
- 13:40Speaker 2: Errors exactly When you match features between images, say, using
- 13:44Speaker 2: sift features and brief descriptors, you often get bad matches outliers.
- 13:49Speaker 2: RANSACK random sample consensus helps find the true transformation the
- 13:52Speaker 2: homography despite these outliers.
- 13:55Speaker 1: Wow.
- 13:55Speaker 2: It randomly picks small subsets of matches, calculates a homography,
- 13:59Speaker 2: and see how many other matches agree with it. It repeats
- 14:02Speaker 2: this and picks the homography supported by the most matches,
- 14:05Speaker 2: ignoring the ones that don't fit.
- 14:07Speaker 1: Finds the consensus ignores the noise. Smart and image mosaicing,
- 14:13Speaker 1: making panoramas.
- 14:14Speaker 2: Yeah, stishing overlapping photos. The usual steps are find features
- 14:17Speaker 2: like sift, match them between images, calculate the homography to
- 14:21Speaker 2: warp them into alignment, then blend the seams open cvs
- 14:25Speaker 2: CV two stitcher class makes it easier. The book also
- 14:28Speaker 2: mentions cylindrical warping for very wide panoramas to handle distortion.
- 14:31Speaker 1: So seamless panoramas are impressive. What about face morphing? That
- 14:34Speaker 1: sounds fun?
- 14:35Speaker 2: It is creating that smooth video transition between two faces.
- 14:39Speaker 2: You need corresponding points on both faces first, Then you
- 14:43Speaker 2: calculate an average shape between them. Then you warp both
- 14:46Speaker 2: original faces towards that average shape. Finally, you blend the
- 14:50Speaker 2: warped images together over time, usually with alpha blending. Meshwarping
- 14:55Speaker 2: is one technique for the warp itself.
- 14:57Speaker 1: Guiding one face to become another by aligning features in
- 14:59Speaker 1: bloe And Finally, registration leads to building an image search engine.
- 15:05Speaker 2: Content based image retrieval, Yeah, a multi step process.
- 15:09Speaker 1: How did it work?
- 15:10Speaker 2: You extract features like sift from every image in your database,
- 15:14Speaker 2: create compact descriptions of those features, index them efficiently. Then
- 15:19Speaker 2: for a query image, you extract its features descriptions and
- 15:22Speaker 2: search the index for images with the most similar descriptions
- 15:25Speaker 2: using tools like flan for speed and ratio testing for reliability.
- 15:29Speaker 1: Creating a visual fingerprint and searching for matches. Powerful stuff.
- 15:32Speaker 2: Definitely okay. Next major area image segmentation, dividing an image
- 15:37Speaker 2: into meaningful parts.
- 15:38Speaker 1: Simplest ways thresholding right. The book mentions OTSU and Riddler Calvert.
- 15:42Speaker 2: Yeah. Basic idea is separating foreground from background based on brightness.
- 15:47Speaker 2: Atsu's method and Riddler Calvert are automatic threshold finders. They
- 15:52Speaker 2: analyze the histogram to find the best split point. Mahota's
- 15:56Speaker 2: library has them. Atsu minimizes variance within classes. Really covered
- 16:00Speaker 2: is iterative.
- 16:01Speaker 1: So they find the threshold for you. Yes. What about
- 16:04Speaker 1: segmentation with self organizing maps SOMs?
- 16:08Speaker 2: SOMs are neural networks used for clustering. You can feed
- 16:11Speaker 2: image pixel data like color into an SOM. It learns
- 16:15Speaker 2: to group similar pixels together on its map. Okay, so
- 16:18Speaker 2: you can use the trained SOM to segment the image
- 16:20Speaker 2: based on which map neuron a pixel activates, or just
- 16:23Speaker 2: to reduce the number of colors. Quantization. The book mentions
- 16:27Speaker 2: using it on handwritten digits.
- 16:28Speaker 1: Letting the data cluster itself. What's random walk segmentation?
- 16:31Speaker 2: That one's interactive. You first label a few seed pixels
- 16:34Speaker 2: for each region you want. Then for every unlabeled pixel,
- 16:37Speaker 2: the algorithm figures out the probability that are random walk
- 16:40Speaker 2: starting there would hit each seed region first, the pixel
- 16:44Speaker 2: gets assigned to the region with the highest probability. Often
- 16:47Speaker 2: gives really nice results.
- 16:48Speaker 1: A guided approach using initial hints. What about segmenting skin
- 16:52Speaker 1: gmm EM algorithm.
- 16:54Speaker 2: Gaussian mixture model GMM and expectation maximization EM. The idea
- 17:00Speaker 2: is that skin colors follow a mix of Gaussian distributions.
- 17:03Speaker 2: You train a GMM on skin and skin examples, then
- 17:06Speaker 2: you use the train model to classify pixels in new images.
- 17:09Speaker 1: Learning the statistics of skin color. Okay, medical image segmentation
- 17:13Speaker 1: again UNED and watershed right.
- 17:15Speaker 2: Deep learning models like UNIT are huge in medical imaging,
- 17:18Speaker 2: now great at learning complex patterns for segmenting organs or tumors,
- 17:23Speaker 2: and watershed via simple ITK is still useful, especially for
- 17:27Speaker 2: separating touching cells or structures.
- 17:29Speaker 1: Then deep semantic segmentation assigning a label to every.
- 17:32Speaker 2: Pixel exactly using models like deep lab V three plus
- 17:35Speaker 2: or FCN not just there's a car, but these specific
- 17:38Speaker 2: pixels are car. These are road, et cetera, pixel level understanding, got.
- 17:42Speaker 1: It, and deep instant segmentation. How's that different?
- 17:44Speaker 2: It goes one step further. Semantic says these are all
- 17:46Speaker 2: car pixels. Instance says this is car hashtag one, This
- 17:49Speaker 2: is car hashtag two, this is car hashtag three inch
- 17:52Speaker 2: with its own mask.
- 17:53Speaker 1: Ah distinguishing individual objects of the same class precisely.
- 17:57Speaker 2: Models like mask URCNN do this. They build on object
- 18:01Speaker 2: detectors like faster RCNN and add a branch to predict
- 18:04Speaker 2: the mask for each detected instance.
- 18:06Speaker 1: Car one, Car two, Car three, each outlined much more.
- 18:08Speaker 2: Detail exactly, okay. Next up image classification, assigning one label
- 18:14Speaker 2: to the whole image.
- 18:15Speaker 1: The book starts with feature based HOG and logistic regression.
- 18:19Speaker 1: We saw HOG for detection.
- 18:20Speaker 2: YEP histogram of oriented gradients. You extract these HG features,
- 18:25Speaker 2: which capture edge direction info, and feed them into a
- 18:27Speaker 2: standard classifier like logistic regression to categorize the entire image.
- 18:32Speaker 2: Classic machine learning pipeline extract features, train classifier, evaluate.
- 18:37Speaker 1: Using gradients as a signature. What about texture classification? Gebor
- 18:40Speaker 1: filter banks.
- 18:41Speaker 2: Gaybor filters are sensitive to orientation and frequency. Great for texture,
- 18:45Speaker 2: a bank is just a set of Gaybor filters with
- 18:47Speaker 2: different parameters. You apply the bank, get a feature vector
- 18:50Speaker 2: describing the texture, and compare it to feature vectors of
- 18:52Speaker 2: known textures.
- 18:53Speaker 1: Analyzing the image grain with special filters. Okay, and then
- 18:56Speaker 1: the big one. Pre trained deep blurring models, transfer lar.
- 19:00Speaker 2: Huge shortcut models like VGG sixteen, mobile NETV two ResNet
- 19:05Speaker 2: inception trained on millions of image neet images they've learned
- 19:09Speaker 2: general visual features.
- 19:10Speaker 1: Do you just use mat in the box pretty much?
- 19:12Speaker 2: You feed your image in get predictions based on the
- 19:15Speaker 2: vast knowledge they already have. The cookbook shows classifying a
- 19:18Speaker 2: cheetah and swans this.
- 19:19Speaker 1: Way, borrowing expertise cool and training a custom classifier using
- 19:24Speaker 1: transfer learning Right.
- 19:25Speaker 2: You take a pre train model, usually chop off its
- 19:28Speaker 2: final classification layer, freeze the early layers which learn general features,
- 19:33Speaker 2: add your own new classification layers on top, and train
- 19:36Speaker 2: only those new layers, or maybe fine tune a bit
- 19:38Speaker 2: more on your specific data.
- 19:40Speaker 1: Set ah adapting it exactly much.
- 19:42Speaker 2: Faster and needs less data than training from scratch. The
- 19:46Speaker 2: book mentions image data Generator for augmenting your data too,
- 19:49Speaker 2: creating variations to help the model generalize.
- 19:51Speaker 1: Taking a generalist model and making it a specialist Okay.
- 19:56Speaker 1: Classifying graphic signs as mentioned next, with challenges like imbalance
- 20:00Speaker 1: and overfitting.
- 20:00Speaker 2: Yeah, important for self driving. Some signs are rare. Imbalance
- 20:04Speaker 2: models might memorize the training data overfitting, so you use
- 20:09Speaker 2: techniques like resembling classes or heavy data augmentation during training,
- 20:13Speaker 2: maybe with PyTorch, to make the model more robust.
- 20:16Speaker 1: Real world considerations. Finally, estimating human pose with open pose.
- 20:21Speaker 2: Finding key body joins, elbows, knees, et cetera. Open pose
- 20:25Speaker 2: is a popular bottom up method. It finds all potential
- 20:28Speaker 2: body parts first, then figures out how to assemble them
- 20:30Speaker 2: into skeletons. Uses a deep network, often VGG based, to
- 20:34Speaker 2: predict heat maps for joins and connection maps part affinity fields.
- 20:37Speaker 1: Finds the parts, then connects the dots. Got it.
- 20:40Speaker 2: Okay? Almost there. Last big section, object detection finding where
- 20:44Speaker 2: things are.
- 20:45Speaker 1: Starting with HOG again but with non maximum suppression. What's that?
- 20:49Speaker 2: When using sliding windows with HOG, you often detect the
- 20:52Speaker 2: same object multiple times with slightly different overlapping boxes. Non
- 20:56Speaker 2: maximum suppression NMS cleans this up. It keeps the box
- 21:00Speaker 2: the highest confidence score for an object and suppresses other
- 21:03Speaker 2: boxes that overlap heavily with it.
- 21:05Speaker 1: Getting rid of redundant detections makes sense. Then y'lo three
- 21:08Speaker 1: you only look once.
- 21:09Speaker 2: Yeah, famous for speed processes the whole image at once.
- 21:13Speaker 2: You'lo A three uses a better backbone network. Darknet fifty
- 21:16Speaker 2: three detects at multiple scales, better prediction layers than older versions.
- 21:20Speaker 2: Great for real time.
- 21:21Speaker 1: Fast RCNN is next. How does that compare?
- 21:24Speaker 2: It's often very accurate, but usually slower than YOLO. It's
- 21:28Speaker 2: a two stage process. First, a region proposal network RPN
- 21:32Speaker 2: suggests areas that might contain objects. Then a second stage
- 21:36Speaker 2: classifies those proposals and refines their bounding boxes.
- 21:39Speaker 1: Propose then classify more deliberate and mask ARCNN builds on this.
- 21:44Speaker 1: For instance, segmentation, which we already covered.
- 21:46Speaker 2: Right, adds that mask prediction branch.
- 21:49Speaker 1: Multi object tracking is mentioned briefly for video.
- 21:51Speaker 2: Yeah, Following multiple objects over time usually involves detecting in
- 21:54Speaker 2: each frame and then associating detections across frames to keep
- 21:57Speaker 2: track of who's who.
- 21:58Speaker 1: Okay and reading tech next East and Tesseract.
- 22:02Speaker 2: EAST is a deep learning model specifically for detecting text regions.
- 22:06Speaker 2: And images even angled or curved text. Tesseract is a
- 22:10Speaker 2: powerful OCR engine for recognizing the characters inside the region's
- 22:14Speaker 2: east finds. Detect, then recognize.
- 22:17Speaker 1: Locate the text, then read it, got it, and finally
- 22:20Speaker 1: face detection with hard cascades.
- 22:22Speaker 2: A more traditional but fast method uses simple rectangular features.
- 22:26Speaker 2: OpenCV has pre trained hard cascades for faces, eyes, smiles,
- 22:31Speaker 2: still useful for real time stuff because they're computationally cheap.
- 22:34Speaker 1: Good overview of detection. Last section. Now, face recognition colorization
- 22:38Speaker 1: generation starting with face net embeddings.
- 22:41Speaker 2: Face net learns to map faces to a point in
- 22:43Speaker 2: a high dimensional space and embedding The trick is faces
- 22:46Speaker 2: of the same person map to points close together, different
- 22:49Speaker 2: people map.
- 22:49Speaker 1: Far apart, a unique vector for each face.
- 22:52Speaker 2: Sort of Yeah. You use a pre trained face net
- 22:54Speaker 2: to get these embeddings, then compare them like with distance,
- 22:57Speaker 2: or train a classifier on them to recognize people.
- 23:00Speaker 1: Digital face fingerpains okay.
- 23:01Speaker 2: Automatic colorization of the CNN, taking grayscale and making it color.
- 23:05Speaker 2: A CNN trained on color images learns the relationship between luminance,
- 23:10Speaker 2: grayscale and prominance color. Given a grea scale image l channel,
- 23:15Speaker 2: it predicts the color channels A and B in.
- 23:17Speaker 1: Lab space, learning typical color patterns always less magical image
- 23:21Speaker 1: generation with the jan.
- 23:23Speaker 2: We mentioned these generative adversarial networks. The generator makes fake images.
- 23:28Speaker 2: The discriminator tries to spot the fakes. They compete and
- 23:30Speaker 2: both get better. The generator learns to make really realistic
- 23:33Speaker 2: images from noise. The book showed training one on anime faces.
- 23:37Speaker 1: The counterfeiter versus the cup Okay and variational auto encoders
- 23:41Speaker 1: vaes for generation and reconstruction.
- 23:44Speaker 2: Vaes also generate images. They learn a probabilistic latent space.
- 23:48Speaker 2: This means they can reconstruct inputs, but also generate new
- 23:51Speaker 2: plausible samples by drawing points from that learned probability distribution.
- 23:55Speaker 2: The cookbook used fashion mnist.
- 23:57Speaker 1: Learns the underlying probability the data, not just to fix
- 23:59Speaker 1: represent interesting last one restricted Boltzmann Machines RBMs for reconstructing
- 24:05Speaker 1: Bangla mnist.
- 24:06Speaker 2: RBMs are older unsupervised models important historically and deep learning.
- 24:11Speaker 2: They learn representations, often of binary data train with contrastive divergence.
- 24:16Speaker 2: They can capture data patterns and reconstruct noisy inputs. The
- 24:20Speaker 2: example showed reconstructing Bangla digits and visualizing the learned features.
- 24:24Speaker 1: Fascinating to see these earlier foundational techniques too.
- 24:27Speaker 2: Absolutely wow. We've really covered a lot of ground, from
- 24:31Speaker 2: artistic filters and making images clearer all the way to
- 24:34Speaker 2: complex detection, segmentation, classification, and even generating totally new images
- 24:39Speaker 2: with Python.
- 24:40Speaker 1: It really is incredible how these algorithms can learn to
- 24:43Speaker 1: perceive and even manipulate images, sometimes better than we can.
- 24:47Speaker 1: And just the sheer number of different approaches to similar problems.
- 24:50Speaker 1: It's kind of amazing, isn't it.
- 24:51Speaker 2: It truly is a really dynamic field. We hope this
- 24:53Speaker 2: steep dive sparks some ideas for you. That Python Image
- 24:56Speaker 2: Processing Cookbook has way more detail and code of course, yeah, only.
- 25:00Speaker 1: Check out the resources. Is something caught your eye makes
- 25:02Speaker 1: you wonder what kind of image challenges or maybe creative
- 25:06Speaker 1: projects could you tackle with these kinds of tools. What's
- 25:08Speaker 1: the next visual puzzle you might want to solve.