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

Function convert_pascal_v1

tools/imglab/src/convert_pascal_v1.cpp:139–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139void convert_pascal_v1(
140 const command_line_parser& parser
141)
142{
143 cout << "Convert from PASCAL v1.00 annotation format..." << endl;
144
145 dlib::image_dataset_metadata::dataset dataset;
146
147 std::string name;
148 dlib::image_dataset_metadata::image img;
149
150 const std::string filename = parser.option("c").argument();
151 // make sure the file exists so we can use the get_parent_directory() command to
152 // figure out it's parent directory.
153 make_empty_file(filename);
154 const std::string parent_dir = get_parent_directory(file(filename)).full_name();
155
156 for (unsigned long i = 0; i < parser.number_of_arguments(); ++i)
157 {
158 try
159 {
160 parse_annotation_file(parser[i], img, name);
161
162 dataset.name = name;
163 img.filename = strip_path(figure_out_full_path_to_image(parser[i], img.filename), parent_dir);
164 dataset.images.push_back(img);
165
166 }
167 catch (exception& )
168 {
169 cout << "Error while processing file " << parser[i] << endl << endl;
170 throw;
171 }
172 }
173
174 save_image_dataset_metadata(dataset, filename);
175}
176
177

Callers 1

mainFunction · 0.85

Calls 9

make_empty_fileFunction · 0.85
get_parent_directoryFunction · 0.85
strip_pathFunction · 0.85
number_of_argumentsMethod · 0.80
parse_annotation_fileFunction · 0.70
fileClass · 0.50
push_backMethod · 0.45

Tested by

no test coverage detected