| 137 | } |
| 138 | |
| 139 | void 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 |
no test coverage detected