Mmodlist ((better)) -
#include <dlib/image_processing.h> using namespace dlib;
detector = dlib.train_simple_object_detector(images, mmodlists, options) img = dlib.load_rgb_image("test.jpg") dets = detector(img) for det in dets: print(f"Class det.label at det.rect, score det.detection_confidence") mmodlist
mmodlist = detector.run(image) # returns mmod_rects rects = [m.rect for m in mmodlist] # just boxes labels = [m.label for m in mmodlist] # class predictions ignored = [m.ignore for m in mmodlist] # usually False for output | Problem | Likely cause | |--------|---------------| | Training crashes with “empty mmodlist” | An image has zero mmod_rect s. That’s allowed, but check that your dataset isn't entirely empty. | | Loss stays high | ignore=True used incorrectly on positive samples. | | Detector outputs wrong class | Mismatch between training labels and test-time expectations. | | Memory explosion | Too many mmod_rect s per image (e.g., 1000+ small objects). Use ignore for tiny or edge objects. | 8. mmodlist in C++ (for custom dlib extensions) If you work with dlib’s C++ API: #include <dlib/image_processing
std::vector<mmod_rect> mmodlist; mmod_rect mr; mr.rect = rectangle(10,20,50,80); mr.label = 0; mr.ignore = false; mmodlist.push_back(mr); | | Detector outputs wrong class | Mismatch
This guide covers the conceptual, practical, and edge-case behaviors of mmodlist in dlib's MMOD system.