Embedding heuristics
Heuristics is essentially codifying rules you have in your head to solve a particular task, typically implemented using a function that returns a score. This is used to rank a set of alternatives. In the previous section, Designing in constraints, we saw how we could use the center of mass and the bounding box to determine how well distributed the pixels are for a segmented image. This in turn could be used to rank each frame, by favoring those with a center of mass near the center of the bounding box. We also implemented a type of heuristic in the application when determining which frames to keep and which ones to ignore by measuring the overlap.
Heuristics can be a powerful ally, but be careful to ensure that the heuristics ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access