The demo will draw bounding boxes on copies of the given images, similar to the GIF above. The results will be stored in IMAGE_DIR/void-detector-outputs/.
Make the data, model, and training pipeline compatible
Convert labels to correct format
The VOC PASCAL format defines the top-left corner as (1, 1), not (0, 0). I'll need to add one to each coordinate in my labels, and change the labeler program for future labeling.
Add one to each coordinate
Fix labeler
The labeler program, reasonably, stores bounding box information of name.jpg in name.txt, with each bounding box on a separate line. I'll need to convert this to torchcv format, where all the bounding boxes for a single image are on one line.
I need to append the video timestamp to label names to avoid name conflicts.
Customize model, and modify training pipeline accordingly
These results imply extreme overfitting, but the visual results show decent performance.
The predictions are in red and the ground truth is in green.
The model detected some voids I missed.
When labeling the test set, I tended to cut large voids into smaller voids with sizes equal to the sizes of nearby products. I didn't do this as often when labeling the training set. This difference in ground truth is likely responsible for a large loss in precision. If so, this shows the importance of documenting changes in the labeling procedure, and shows a benefit of standarizing the labeling procedure.
Consider adding "name.jpg" to the label list, as opposed to "name.jpg xmin ymin xmax ymax class"
Rejected: The pipeline doesn't know how to handle empty cases
Consider adding "name.jpg 1 1 height+1 width+1 1", where 1 is the voidless class
Rejected: This will disable hard negative mining, skewing the model toward voidlessness. A model could get a good score by labeling all regions as voidless
Consider adding "name.jpg 1 1 height+1 width+1 -1", where -1 is the voidless class
Accepted: This will ensure voidless regions are considered negative examples in hard negative mining
Hard negative mining returns nothing when there are no positive examples. Figure out what to do.
If there are no positive examples, I'll return five negative examples. Let this be a hyperparameter.
Warning: This hyperparameter seems more dangerous than usual with respect to overfitting. I'll likely leave it at five instead of tuning it.
Train with voidless images (output: Model 2)
Inspect and report results
Average precision:
Train: 0.6276 (N: 476) (1st model: 0.9041))
Test: 0.1541 (N: 100) (1st model: 0.1604))
Model 2 slowed the system down significantly.
Model 1 took 10 seconds to evaluate on the training set. Model 2 took 27 minutes.
Model 2 outputted 100 times more location predictions than Model 1, which is the default behavior of the architecture; i.e., Model 2 is far closer to random than Model 1.
I expected Model 2 to outperform Model 1, because I gave it more information. In particular, I expected Model 2 to have fewer false positives than Model 1, but potentially fewer true positives, too. Is there a bug in my code, or are the voidless images derailing the training process?
I expected more than 0.03% improvement w.r.t. Model 1 (and it might just be noise), but at least the bug is gone. Later I'll train the models until convergence with the current hyperparameter configuration, and afterward start tuning the hyperparameters.
GPS. This might not be reliable enough. It would add to hardware costs, too.
Count grocery cart wheel rotations and measure wheel angles. This would add to hardware and maintenance costs
Other non-GPS distance measurers
Efficient hand-labeling:
Label a void in one frame, then use an object tracker to label the void for the rest of the frames. This would multiply the number of labels by about 30, assuming a 30 FPS camera and a void-on-screen-time of one second.