Generating the example

The _generate_example method can be defined with any signature. This method is called only by the _split_generators method, and therefore, it is up to this method to correctly invoke _generate_example with the correct parameters.

Since we haven't overwritten the parent _split_generators method, we have to use the same signature required by the parent. Hence, we have the data_path and set_name parameters to use, in addition to all of the other information that is available in the PASCAL VOC 2007 documentation.

To goal of _generate_examples is to yield an example every time it is invoked (behaving like a standard Python iterator).

From the dataset structure, we know that, inside VOCdevkit/VOC2007/ImageSets/Segmentation/ ...

Get Hands-On Neural Networks with TensorFlow 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.