MCPcopy Create free account
hub / github.com/davisking/dlib / main

Function main

examples/dnn_instance_segmentation_train_ex.cpp:666–771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664}
665
666int main(int argc, char** argv) try
667{
668 if (argc < 2)
669 {
670 cout << "To run this program you need a copy of the PASCAL VOC2012 dataset." << endl;
671 cout << endl;
672 cout << "You call this program like this: " << endl;
673 cout << "./dnn_instance_segmentation_train_ex /path/to/VOC2012 [det-minibatch-size] [seg-minibatch-size] [class-1] [class-2] [class-3] ..." << endl;
674 return 1;
675 }
676
677 cout << "\nSCANNING PASCAL VOC2012 DATASET\n" << endl;
678
679 const auto listing = get_pascal_voc2012_train_listing(argv[1]);
680 cout << "images in entire dataset: " << listing.size() << endl;
681 if (listing.size() == 0)
682 {
683 cout << "Didn't find the VOC2012 dataset. " << endl;
684 return 1;
685 }
686
687 // mini-batches smaller than the default can be used with GPUs having less memory
688 const unsigned int det_minibatch_size = argc >= 3 ? std::stoi(argv[2]) : 35;
689 const unsigned int seg_minibatch_size = argc >= 4 ? std::stoi(argv[3]) : 100;
690 cout << "det mini-batch size: " << det_minibatch_size << endl;
691 cout << "seg mini-batch size: " << seg_minibatch_size << endl;
692
693 std::vector<std::string> desired_classlabels;
694
695 for (int arg = 4; arg < argc; ++arg)
696 desired_classlabels.push_back(argv[arg]);
697
698 if (desired_classlabels.empty())
699 {
700 desired_classlabels.push_back("bicycle");
701 desired_classlabels.push_back("car");
702 desired_classlabels.push_back("cat");
703 }
704
705 cout << "desired classlabels:";
706 for (const auto& desired_classlabel : desired_classlabels)
707 cout << " " << desired_classlabel;
708 cout << endl;
709
710 // extract the MMOD rects
711 cout << endl << "Extracting all truth instances...";
712 const auto truth_instances = load_all_truth_instances(listing);
713 cout << " Done!" << endl << endl;
714
715 DLIB_CASSERT(listing.size() == truth_instances.size());
716
717 std::vector<truth_image> original_truth_images;
718 for (size_t i = 0, end = listing.size(); i < end; ++i)
719 {
720 original_truth_images.push_back(truth_image{
721 listing[i], truth_instances[i]
722 });
723 }

Callers

nothing calls this directly

Calls 12

load_all_truth_instancesFunction · 0.85
ignore_some_truth_boxesFunction · 0.85
train_detection_networkFunction · 0.85
serializeFunction · 0.70
sizeMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected