Code & Cure
Decoding health in the age of AI
Hosted by an AI researcher and a medical doctor, this podcast unpacks how artificial intelligence and emerging technologies are transforming how we understand, measure, and care for our bodies and minds.
Each episode unpacks a real-world topic to ask not just what’s new, but what’s true—and what’s at stake as healthcare becomes increasingly data-driven.
If you're curious about how health tech really works—and what it means for your body, your choices, and your future—this podcast is for you.
We’re here to explore ideas—not to diagnose or treat. This podcast doesn’t provide medical advice.
Code & Cure
#37 - Training A Neural Network On Toilet Photos
Use Left/Right to seek, Home/End to jump to start or end. Hold shift to jump forward or backward.
What if a single smartphone photo could make colonoscopy prep more reliable? Colonoscopy can save lives through early detection of colorectal cancer, but its success depends on one stubborn detail: a clean colon. When bowel prep falls short, important findings can be missed, procedures can take longer, and patients may have to repeat the entire process. The question is simple but important: could there be an easier way for patients to know whether they are truly ready before heading to the clinic?
In this episode, we explore research that puts artificial intelligence to work on exactly that problem. Using a smartphone app, patients take a photo of their final bowel movement and receive an immediate yes-or-no result about whether their preparation is adequate. We break down how the system works, from convolutional neural networks and expert clinician labeling to data augmentation that helps the model adapt to real-world conditions like poor lighting, different angles, and varying distances. We also unpack a key challenge in medical AI: overfitting, and why strong performance in a study does not always guarantee success in everyday use.
The potential impact is significant. Patients in the intervention group achieved better bowel cleansing quality, suggesting a practical way to improve the consistency and effectiveness of colorectal cancer screening. At the same time, important questions remain about adenoma detection, repeat procedures, and how tools like this fit into clinical workflow. This is a fascinating example of AI solving a very human problem: reducing friction, improving preparation, and helping patients get the most out of an essential preventive test.
References:
An Artificial Intelligence-Guided Strategy to Reduce Poor Bowel Preparation: A Multicenter Randomized Controlled Study
Gimeno-García et al.
American Journal of Gastroenterology (2026)
Design and validation of an artificial intelligence system to detect the quality of colon cleansing before colonoscopy
Gimeno-García et al.
Gastroenterology and Hepatology (2023)
Credits:
Theme music: Nowhere Land, Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0
https://creativecommons.org/licenses/by/4.0/
Poop Talk And A Real Problem
SPEAKER_01Let's talk about poop. Because when colonoscopy prep goes wrong, the whole test goes down the toilet. Could AI help clean things up?
What Colonoscopies Screen For
SPEAKER_02Hello and welcome back to Code and Cure, the podcast where we decode health in the age of AI. My name is Vasant Sarathi, and I'm a cognitive scientist and AI researcher. And I'm with Laura Hagopian.
SPEAKER_01I'm an emergency medicine physician and I work in digital health.
SPEAKER_02We're gonna talk about poop today.
SPEAKER_01I love poop.
SPEAKER_02Yeah, it's yeah, it's it's an interesting topic because of the number of euphemisms that people use to describe it. But you know, when we can, we will try to use the word poop just because it's a funny word.
SPEAKER_01It is, it is a funny word. And um, we're talking about colonoscopies in particular, which are used for many things, but most commonly used for colorectal cancer screening, which everyone should be getting, you know, starting at the age of 45.
SPEAKER_02So tell me more about that. Like what is it? And what what is colorectal um cancer screening and what does that entail?
SPEAKER_01Yeah, so there's um so screening means you're checking for a d a disease when someone doesn't have any symptoms of it. So you can screen someone for high blood pressure, you can screen someone for diabetes, you can screen someone for colorectal cancer. And the whole idea with these screenings is to find a problem before it gets worse, when it's like easier to step in and treat it. Yep.
SPEAKER_02Okay.
SPEAKER_01And so it can be done. Colorectal cancer screening can be done in a variety of ways. You can do stool testing, you can actually do a special kind of CAT scan, and you can do direct visualization, which is what a a colonoscopy is.
SPEAKER_02Okay.
Why Bowel Prep Quality Matters
SPEAKER_01There are other reasons to do colonoscopies too, you know, diagnosing a disease, taking a biopsy, etc. But um, the whole idea is you want to get a good look at the inside of the intestines. And so you put a camera up and you literally look at the intestines. And in order to do that, it has to be cleaned out essentially, right? You can't have any, you can't have any poop in there.
SPEAKER_02Right.
SPEAKER_01Right. And so you have to cleanse the bowels, which is like a process.
SPEAKER_02Yeah.
SPEAKER_01Um, many of you have probably heard people talk about the prep for colonoscopy. There's different ways you can prep for it, but like one of the common ways is you get, you know, four liters of liquid that you have to drink that has mirror in it, for example.
SPEAKER_02And what's miralac?
SPEAKER_01It it basically is a bowel cleanser. Got it. So, you know, at first you start to poop out stool, and then eventually it's more of a rectx effluent.
SPEAKER_02It's like oh, that's another that's another euphemism, right? Rectal effluent.
SPEAKER_01Yeah. Yes, okay. It's just the stuff coming out, but you want it to be clear. You don't want it to have poop anymore because if there's stool in it, it's gonna make it harder to see what's going on in there.
SPEAKER_02And so so this is the so the day before so the day off and the day before your screening, your colonoscopy, uh, this these are the things that people have to do to clear their system in a sense, clear their intestines, and and you know, uh, they have to take these liquids and and and it and not eat anything, I'm assuming, also. And yeah, yeah, exactly.
SPEAKER_01You're like, you know, clear clear liquids.
SPEAKER_02Yeah.
SPEAKER_01So the thing is you want to get a good study done in order to screen someone or to diagnose someone or whatever it is, you want to be able to visualize it. Right. And so if if the bowel is not cleansed enough, it can actually make the procedure take longer because you're like trying to look around, see stuff, and you can't really see it that well. Right. Um, it can it can make it so that they can't even do it.
SPEAKER_02If if I was gonna say, do they just send people back if they're ready? They might. Yeah.
SPEAKER_01So can you imagine drinking all that stuff and then being told, oh no, it wasn't good enough, you have to do it again.
SPEAKER_02Yeah, yeah.
SPEAKER_01Yeah, that sounds terrible. So you might need to have another examination, which which, you know, it's wasting everyone's time, but can you imagine doing the prep and being said, oh no, you're gonna have to do it again so that we can do the this test? Um, it can make it logistically hard for the patient, for the for the providers who are doing that procedure.
SPEAKER_02Do they do they just to interrupt you real quick? Sorry, I have to ask this question, do they tell the patient what to look for to decide that they're ready? Or do they just say, hey, take this, you know, how many over gallons of this liquid? And once you're done, that's all we expect you to do. We don't have to check anything.
SPEAKER_01Yeah, they do tell people what it should look like, but I mean, would you know exactly what to look for on the patient? I mean, I think like a nurse, for example, or a physician would be able to like look in the toilet and be like, yes, that's good rectal effluent.
SPEAKER_02Yeah.
The AI Idea For Readiness
SPEAKER_01We people, it gets described to people, but you know, there's problems with the prep. Some people get nauseous, you know, maybe they can't finish it, maybe they think it looks okay and they stop. You know, there's lots of things that can sort of get in the way. So wouldn't it be nice if you had something trained on lots of images? Like a nurse has seen all these rectal effluents. What if an AI had seen lots of rectal effluents and could say, yes, this is what it should look like? This is going to be a good prep. This is going to be a good procedure. Because what the last rectal effluent looks like is a really good predictor of how good the bowel prep is.
SPEAKER_02Got it, got it. That makes sense. And yeah, so the so it, you know, there is a it again, once again, we're bringing it into AI now, but there is a clear potential use case for clear.
SPEAKER_00See, what about that clear rectal effluent? I'm sorry, I had to do it. It was a dad joke.
SPEAKER_02This is gonna happen throughout, I'm sure. But um, but that's that's the focus of this paper, right? They um built such a system to look for that. In fact, they built one a couple of years ago and they tested it, it worked well, and then now they have done a recent study in which they actually employed it, put it on, uh, gave it to patients and had them track it, right?
SPEAKER_01Yeah. So I'd love to hear more about how they built out this model that was trained on lots of different images.
SPEAKER_02Yeah, yeah, yeah, yeah. No, it's it's a pretty straightforward model in today's world because it is a uh a flavor or a type of neural network model called a convolutional neural network, which is the sort of state-of-the-art model, in a sense, for image uh classification. And image classification is a type of task in which you give it an image and you ask it what's in the image. Is it um, you know, is this a cat or a dog, for example. You give it a bunch of images of cats and dogs, and a convolutional neural network will learn that. Now, what makes a convolutional neural network unique is that it's set up well for images and it kind of, kind of uh models how human visual uh how how the human visual system works in layers. You know, first get the edges and then get the you know more and more features and more and more you know interesting aspects of the image. It's kind of built up over time. And so the convolutional neural network works like that in a sense, and it um it it is it is you know, it is a fancy approach, but it's not a fancy approach in today's world. You know, it was quite a revolutionary when it came out, um, just because how good it was and how good it was at doing things with images. And now we're used to it, right? You go on on Facebook or you know, you pop up a picture on your phone, even, and it's able to pull out um similar faces and and identify people in them and so on. So those are all at some level using convolutional neural networks, and that's the system that they use here. Now it's not the architecture or the machine or the neural network that's unique, but in this particular case, it's applied to these rectal effluents. And what they did was they took a bunch of images of good and bad, adequate quote unquote adequate and inadequate. Right.
SPEAKER_01And these are not labeled by you know lay people who are doing the prep. They're labeled as adequate or inadequate by you know providers who have done this many, many, many times. Of course.
SPEAKER_02So what they do was they create this large data set, potentially equal numbers of adequate and inadequate examples, potentially where the adequate examples has a whole host of little variations in it, but um, but it's but generally captures it, you know, and um and you have to remember that in a real setting, a human using this before their um colonoscopy is going to use a phone or something to take a picture. So they have to decide what distance it's going to be at, what you know what what what is in the image, how zoomed in, not how zoomed out it should be. So they make all these decisions and take um a bunch of images of what's adequate and inadequate. There's two labels. And that's it though.
SPEAKER_01Those are the those are the only labels. Like if you're the provider looking at it, if you're like an endoscopist looking at it or nurse looking at it, you're like, oh, well, how turbid is it, or like what color is it, or are there any solid particles in the those are the things that like you're thinking of, but that that that's not what goes into the model.
SPEAKER_02No, so you could approach the model that way, right? You could build a much more complicated model in which you take those images and then you identify turbidity and particle, part particulate matter, or whatever, right? Uh, whatever feature features you care about, you could manually decide, okay, this is what a doctor cares about, list all those features out, and then find smart ways using technology in computer vision to extract that out from the image and then use those features to predict what the adequate versus inadequate role is. This is how machine learning was done in the 90s. You would you would manually craft features and then you would apply machine learning techniques to do it. But that's not what the deep learning revolution came around, made simpler because then you don't have to worry about features because maybe, just maybe, your human way of thinking is actually suboptimal in some ways. Maybe you're not capturing things that are there and in fact do matter beyond the features that you've just identified. And so let the machine learn the features for itself. That's what the neural network revolution is all about. You just give it the images and you just give it the final output and you train it to best characterize all the images across the different classes of final outputs.
SPEAKER_01But we don't know what the sort of reasoning is behind it. It's just like we have the in and we have the out. And we've trained it on a bunch of images, and like you said, they all have to be, oh, this is, you know, uh 50 centimeters from the toilet bowl. Make sure that it's a white toilet bowl and not a black one or whatever it is. Don't use a flash, etc.
Overfitting And Data Augmentation
SPEAKER_02Yeah. And in fact, that that's it. But but I think there's some lighting effects and all those things that matter, and there's some cool pieces of technology that helps you deal with that. But one issue in machine learning in general is something called overfitting. It's a jargon word. It just means that when you train a model on a bunch of data, there is a risk that it learns that data really well. So when you test it on parts of that data, uh, what you actually do is you you you don't give it all the data. You give it like 80% of the data, and then you keep set aside 20% of the data or whatever small amount, which you don't show it at all. And then you use that for evaluating its performance.
SPEAKER_01Okay.
SPEAKER_02But it's all from the same big giant pile of data, right? So because that giant pile of data is one data set, there's a risk that the model learns that data set really well. Like you've trained it on the 80% and then it does really well on the 20%. That doesn't tell you for sure how it's going to do in the real world. And so there's a risk of what's called overfitting, which means you are doing you overfit the model, as in the model's setup is really well tuned for that data set. And it feels like it's a good model. So there's a risk of that happening. So the way they avoid that risk is to augment the data. They will one one way to do that is there's many ways to do that. One way that they do here is to augment the data. So what they do is they take all these images that they have answers for, adequate and adequate, and then they make slight alterations to it. They change the angle, they did they make it more saturated with with more exposure, less exposure, more light, less light. Like you can just you can just use image processing techniques to change the image. You still know it's the same exact picture, right? You already know the answer to the picture. So, but now if you change that from one sample data point, you might get a hundred more. So now you times a hundred, the whole data set.
SPEAKER_01Oh, interesting.
SPEAKER_02And you get more variety. Um, and you could think of this in the language space, it's very similar, but you can you might have you know a spam detector email, and you might have a bunch of email uh letters, uh emails that are spam and not spam. You could do the same thing. You could add like dots and dashes in between, you could add some kind of noise in between. All of that it doesn't change the spamminess of an email.
SPEAKER_01Right. And so it doesn't change whether the prep is adequate or inadequate.
SPEAKER_02Right, but it but it helps the model gain a better sense for what it should actually, what actually matters.
SPEAKER_01Yeah, because in the real world, you know, you maybe someone is taking the picture upside down or doesn't have good overhead lighting or takes it from farther away or closer. Yes. If you could zoom, does it zoom in too, maybe? Yeah, yeah, yeah.
SPEAKER_02I mean, so so yes, so that they do all of those variations and extensively augment the data and then train the model on that. And so now you have a better model, potentially more robust to real world type situations. And you know, you could also just tell the user when they're taking pictures, you know, keep it so far. You know, you have those um uh bank apps that scan checks and they tell you you're too close or too far, and things like that. That's part of it, is just to guide the user to make sure that it's closer to what the model has seen and is better is going to do a better job of classifying that. So it's the same idea here. And so you could imagine that there's a bunch of techniques that people use to ensure that the model is um given the best form of data, uh, both at training time, but also then when it's actually doing the job later.
SPEAKER_01Yeah.
SPEAKER_02Um, but that's broadly what they do, and it's not a like I said, it's not a fancy technique, but it's clearly a really smart idea in this particular use case.
The App Trial Green Or Red
SPEAKER_01Well, absolutely. I mean, I think that's what they found here is that it really like using AI here really worked. So what they did was they took um they took a bunch of people and they separated them into two groups. One group was like getting the usual instructions. They got, they got prep instructions because everybody does. Like, here's what you do, here's how you drink it, here's what it should look like. They got it orally, they got it written. But then what they did with the second group, the intervention group, is that they instructed them to use a phone app where they would take a picture of their last rectal effluent in the toilet bowl. And it was, you know, make sure you have adequate lighting, make sure it's over a white background, don't use any flash. You should be about 50 centimeters from the toilet bowl. And that makes sense because like that's the data that it was trained on, right? Yes. And so they were able to use this model that had been trained on this data and either get a green light or a red light. It's just like a yes or a no. Is this good or not? Binary. Yeah. And if it was a green light, it means, hey, your prep was adequate. Go ahead on with the colonoscopy. We think it's gonna be successful. And if it was a red light, that meant, hey, you should do some more bowel prep. Oh, interesting. That four liters wasn't enough. Don't you want some more? And it would tell them what to do. Yeah. Whatever. I mean, it depends on what prep they they had done. There's different kinds of ways to prep for a colonoscopy, but basically they were like, here, if you if your prep wasn't good enough, we recommend you do this additional amount of prep. Um, and and that's it. That's it. Let's try to get your rectal effluent looking better so we have a better chance of a more successful procedure. Yeah, yeah, yeah.
SPEAKER_02Makes sense. And yeah, and it seems like that it worked.
SPEAKER_01Yeah, it worked. I mean, basically, they had the endoscopists who are doing the procedure sort of grade, how clean the bowel were bowel was. And um it was definitely different in this intervention group. It was, it was much cleaner. The bowel cleansing quality was much higher for the people who had done this. And that makes sense, right? Because if your ractal effluent isn't clear enough and then you're able to clear it, then the the procedure is more likely to essentially be successful. And so they did this, they looked at overall, like the entire colon, and then they looked at different segments of the colon. And basically, no matter what, they found that people who did this intervention had uh cleaner bowels.
SPEAKER_02That's great. So the results seem promising.
SPEAKER_01They are promising. I mean, I think there's more work to be done here because what you want to see is hey, did we did we detect more polyps? Did we detect more adenomas? And they didn't find a statistically significant difference there, but it would make sense that the better you can see the colon, the intestine, the the more likely you are to be able to find these problems and you know take care of them. Yeah. Um, and there are other things that they could have assessed that they didn't happen to that we know are products of poor bowel prep, like having to go back and do another test or procedure or having procedures take a longer amount of time. So I I think this is a great study because it's it's something that's like very simple. People usually don't mind. I know it's a little weird take a photo of your rational influence, but like people generally don't mind taking a photo and putting it into like a medical app to be like, hey, is this procedure gonna work for me or not? It's like takes you, you know, under a minute to do this to figure out do I need to do something else, do I need to do more, or am I in good shape? I feel like just knowing that ahead of the procedure is something that would make you feel really good as a patient, too.
SPEAKER_02Yeah, yeah. It's a way to check check for it, right? Check, check, do the check that the doctor would do instead of showing up at the at the hospital and then realizing that you have to go back and do this all over again is ridiculous. So why the why why? Right? You'd prefer doing it at home and figuring it out.
SPEAKER_01Yes. And the fact that this is trained on so much data, you're not relying on a uh a human who's only seen this happen to them, you know, once or twice before to say, oh, that's what it that looks good in the toilet. Like, what if people don't know?
SPEAKER_02Yeah, yeah, yeah.
SPEAKER_01So I think this is a really cool application. And it was definitely interesting to talk through how they train the model. And then, you know, again, this is like it feels like a pretty simple application in some ways, this, but it it also is something that can um improve operational complexity that can make it better for patients, that can make it better for providers, um, you know, because of its simplicity.
SPEAKER_02Yeah, and I really like it because for exactly for that reason. And it doesn't get in the way for anybody, uh, you know, and it's just all automated, right? So it's not like you have to worry about the health records and and figure out no, it's none of that. It's just it checks and tells you right away, and that's it, you're done. And then you show up in the hospital and and you're you're in a better position already.
SPEAKER_01Or at the ambulatory care center.
Adoption Privacy And Wrap Up
SPEAKER_02Oh, right. Perhaps. Yeah. Um they did talk a little bit at the end about um challenges. And I I always wonder about adoption for things like this. Like, what does it would you do this?
SPEAKER_01This is my question. Like, would you take a picture of your rectal effluent in the toilet for an app?
SPEAKER_02Like it's not gonna go anywhere else. I would do it, yeah. Absolutely.
SPEAKER_01Yeah. I I feel like the same way. It's like I want to make if I'm gonna do this prep, I want to make sure it's good before I go and get the procedure done. Agreed. So I don't know. I mean, I I'm curious to see if this will become like more of a standard of care because it seems like it's simple, it's easy to implement from our N of two, both of us would do it.
SPEAKER_02Yeah. Yes, that should be enough, right?
SPEAKER_01Yeah, exactly. All right. Well, um, thank you for joining us today on Code and Cure.
SPEAKER_02Thank you.
SPEAKER_01We'll see you next time.