Every model I build has to answer 1 simple question | Airbnb Machine Learning Project Part 5

Daniel Bourke spends week 3 of his Airbnb object-detection project integrating Weights & Biases for experiment tracking into his Detectron2 training loop. After debugging CUDA errors, he gets loss and average precision logging working on a custom dashboard. Data conversion and model scaling slip to week 4.
Chapters
Would you look at that? We can tick off week 2 of the 20-Friendly-ifying Airbnb's object detection pipeline. We are up to day 15. Hey look, there's a bug, checking it out. Week 3, how exciting! Let's go over and check out the whiteboard, the whiteboard of peace, like my personal assistant. We need to first of all update this as usual. Day 15. Oh, that doesn't really look very good, but that's all right. Progress, not perfection. Okay, so week 2, we can tick that off. In the last video, we built a small model. So we've got a small model working. So that is really amazing. Week 3, refine data sources. I'm going to bring this down into here because we want to get all of our images ready in week 3. And start scaling up model with data sources. Well, that would make sense if we refine the data sources first, aka get rid of— get all of Open Images images ready for Detectron 2. I'm going to put another one here. Track experiments. Track experiments is because I'm going to probably be building multiple models. How will I know which one performs best? What type of settings I'm using, hyperparameters, that sort of stuff. And so let me show you what I've got in Notion planned out for this week in terms of how I plan to do that. So it is officially week 3 as dictated by the Notion board. I got here code refactoring, downloading all the data, and model scaling up. So we got our small model built last week, which is amazing. So this week we're going to start to scale it up using more data because the model model we built last week was only using a very small subset of the data. And so this is how I plan at the start of my week: download and convert all images and labels to Detectron2 style labeling, track experiments with Weights and Biases. Now Weights and Biases is a tool that I've been really looking forward to use in, in one of my own projects. So I'm actually 10 out of 10 excited to try and use this. It's a, it's a tool that you can use to track your different experiments with machine learning models, which is what I'm going to do here, because as I said before, it's important to know what worked and what didn't work. Um, scale up model to work with more than one class— that's going to build off the back of this downloading, converting all images. And then clean up my crummy code. So the code I wrote over the past 2 weeks could definitely be improved, so I'm going to try and start doing a little bit of that now. But because today is Monday and Mondays are Research Mondays, I'm going to be researching ways to track experiments, aka mostly looking at Weights and Biases. I've got an article here of one of the tutorials. Because Detectron 2 is built in PyTorch, I'm going to just check out the Weights and Biases article, um, Intro to PyTorch with Weights and Biases. So that's how I'm going to start. I think the first half of this week is going to be setting up experiment tracking, and then the back half of this week is going to be scaling up the model on all the data. That's my rough idea for how this week's going to pan out. May turn out that way, may not, but anyway, welcome to part 5. What can we call this one? Tracking experiments. We are on day 17, and the reason why I love the number 17 is because I have a dog named Seven. So, 7 is kind of my lucky number. But let me give you a quick update of where we're at. Actually, the Notion document is probably the best place to start this. So, I'll just show you exactly what I'm, I'm writing, I'm thinking about. So, you can see day 17, let's figure out how to create my own Detectron 2 training loop, which tracks results. And so I had an idea yesterday. We link down to this, my idea late yesterday, day 16, which was one of those days. I'll put it here. Today is one of those days where I'm trying to figure something out. So I'm not sure how long it'll turn out. I know what I'd like to get done. And that's a way to have, and that's have a way to track the different experiments I run. We'll probably only get a good hour or so in today because yesterday, as you can see, life got in the way, so I just had to work around that. But these things happen, right? So yesterday I didn't get too much done other than just read through a bunch of Detectron2 documentation, which actually turned out to be really valuable because that's when I got this idea, the end of late yesterday. So merge plain_train_net.py my Detectron2 code and the Weights and Biases PyTorch example notebook into my own Detectron2 experiment. And so that's what we're trying to do today. So you see here, 12:56 PM, which is about now. Let's see what happens when we try to merge plain_train_net.py, a Detectron2 script, my own Detectron2 preprocessing notebook, and the Weights and Biases PyTorch example. So long story short, I'm trying to scale up my Detectron2 models. And so I thought the easy option is to just start building a larger model with all the data. But where's the fun in that, right? What if something goes wrong? Where am I going to look? What if I'd like to improve something? So rather than just scaling the model up straight away, what I'm going to do is sort of build in a little bit of redundancy because I know a small model will work. So I'm going to get a little bit more familiar with the training process and see what happens when I create my own training loop, which is what is provided here. We come into the Detectron2 documentation or the Detectron2 GitHub in plain_train_net.py. So Detectron2 training script with a plain training loop. So I've been reading through this, but again, always remember that you're a lot smarter when you're actually doing something than you are just thinking about something. So yesterday was all about thought for me. Today is all about doing. So I'm pretty lucky I'm going to get a few hours of good coding in, at least I hope. Who knows what could happen. But essentially what this script does is it gets a Detectron2 model based on some sort of config file, creates that Detectron2 model. It has a function called do_test and do_train. And so the do_train trains your Detectron2 model and then the test does inference on your model to see how it goes. And so what I'm looking to do is, because I want to incorporate Weights and Biases to track my experiments, is I want to basically refactor this notebook with my own Detectron2 small model building custom data notebook with the introduction to Weights and Biases PyTorch notebook. So that's a mixture of three different blends, shaken, not stirred. So we'll see how this turns out. As you can see, I've kind of just took the intro to PyTorch with Weights and Biases and created my own version. And I know I'm kind of just blazing over this at the moment, but what I figured is because it's day 17, I'm going to spend the next few days working on this. And then we'll see by the end of this video, who knows where I'm going to get to. But what I'll do for day 21, I think, is just like an extended long video maybe a live stream. You'll see, you'll see it on the channel when it comes up, whatever it is, of just walking through the code step by step of where I'm thinking, what I'm doing, how I think about things. And if it's a live stream, that way you'll be able to ask questions. So without any further ado, I'm going to pay attention to my second brain here, or my personal assistant, and see what happens when I try to merge plain_train_net.py my own Detectron2 preprocessing notebook, and the Weights and Biases PyTorch example. I'll see you when I have a pretty significant update. Fingers crossed.
2 days later.
Welcome back. We are finally back. Can you believe it? It is day 19 of week 3, so the last day of week 3, Friday. And at the start of this week, we set out a few goals. So that's where the start of this video started. I was like, this week we wanted to download and convert all images and labels to Detectron2 style labeling. Well, I haven't done that. Track experiments with Weights and Biases, we'll come back to that. Scale up model to work with more than one class, haven't done that. And clean up my crummy Detectron2 code, haven't done that. Potentially have made it— what's this error? Doesn't matter. Potentially have made it a little bit more crummier. So I've got a bunch of refactoring to do, but the good news is I said we, we did have kind of two overall goals for this week if we could do it. And that was to be able to track experiments and to scale up the model that we've got working at the same time as tracking the experiments, aka trying different models, trying different sets of data, trying more data. The good news is we've got one of the two. And that is that we have built in an ability to track experiments with Weights Biases. But that did not come without any gargantuan effort. I mean, it took a lot of effort. I mean, hours and hours and hours and hours of me just basically bumping around different documentation, trying out code, seeing if it works, trying to merge a whole bunch of different scripts together into my own. But the good The good news is we have— I can't believe this timing. We always get the breakthroughs at like Friday afternoon. We ran into another CUDA error, but we got that solved because, you know, the thing is, nature's gonna throw these challenges at you and you have a couple of options. You can either attack it with effort. You can be like the man rowing a boat. The man rowing a boat uses effort. You can just let it happen and be like the man who puts up a sail and uses magic to travel around. So that's what we did. We used magic, we fixed our CUDA error, and we finally got Weights and Biases working to track experiments. If you're wondering what Weights and Biases is, it's like a plugin tool that you can plug into your code. Works with basically all of the deep learning and machine learning frameworks that you'll use, and it creates this cool little dashboard where you can track things like different metrics. In my case, I'm tracking, I believe it's the loss loss and the average precision. They're the two metrics I'm tracking at the moment. At the moment, my dashboard is pretty primitive, but nonetheless, it is set up, it is working. I've got a custom training loop for Detectron 2. Yeah, a custom training loop. So all of these things I'm going to be fixing next week to scale up the modeling, basically moving what we didn't complete from the whiteboard in week 3 aka start scaling up the model with different data sources and download and prepare all the Open Images to week 4, because we can tick off track experiments.
Haha!
Win-win! With all that being said, I figured there's almost too much for me to go through in these sort of short style videos. So what I'm going to do is after this one comes out, because by the time the next video comes out, we'll be halfway through the 42 Days Project, so 21 days, so the halfway point, I think it's a good time then to do like an in-depth video where I'll go through all the code and what's happening and potentially even livestream refactoring it all because that'd be a bunch of fun, wouldn't it? Nonetheless, the takeaway from this week is to, if you're working on your own machine learning projects, have a way to track your experiments like what I'm doing with Weights and Biases. You might want to check it out. There'll be a link in the description that there's a bunch of tutorials that they've created. That's, that's what I've used to build mine. Track your experiments so you know what works and what doesn't. That's what we're going to be doing next, tracking our experiments whilst we scale up our models with more data and different models. Because every model I build goes through a series of rigorous tests, all to answer one simple question: Is it a banger?
How many beats per minute? How many drops? How dope were the drops? Were any acoustic instruments used? If so, it is not a banger.
Make sure you tune in to the next video where we will find out the answer to that question. It will officially be week 4 of of the 6-week project, 2025 AirBnB's object detection pipeline. Anyway, it's Friday night, you know what that means. I'll see you next time.
I once accidentally downloaded a Lumineers song. I had to throw away my whole computer just to be safe.
More from Daniel

Small Language Models (SLMs) Are the Future: Fine-Tuning AI That Runs on Your iPhone

Introducing Sunny - A MedGemma-Powered Skin Health Tracking App (Kaggle Competition Entry)

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 4 - Comparing the results

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 3 - Running LLMs on the RTX 4090

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 2 - Formalizing the tests

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 1 - Creating a series of tests

Local Multimodal RAG on the NVIDIA DGX Spark | Part 4 - Publishing our demo to Hugging Face

Local Multimodal RAG on the NVIDIA DGX Spark | Part 3 - Putting it all together


