Is there a way to use the method "flow_from_dataframe" from keras ( https://keras.io/api/preprocessing/image/#flowfromdataframe-method ) to load an image with a mask? Such that instead of y being a category, y is a path such that a binary mask gets loaded together with the image.
An example dataframe to load the data would be:
+---+---------------------+---------+-------------------------+
| | img_path | subject | mask_path |
+---+---------------------+---------+-------------------------+
| 0 | images/DSC_4540.TIF | 4540 | masks/DSC_4540_mask.tif |
+---+---------------------+---------+-------------------------+
| 1 | images/DSC_9228.TIF | 9228 | masks/DSC_9228_mask.tif |
+---+---------------------+---------+-------------------------+
| 2 | images/DSC_6674.TIF | 6674 | masks/DSC_6674_mask.tif |
+---+---------------------+---------+-------------------------+
| 3 | images/DSC_3453.TIF | 3453 | masks/DSC_3453_mask.tif |
+---+---------------------+---------+-------------------------+
| 4 | images/DSC_6808.TIF | 6808 | masks/DSC_6808_mask.tif |
+---+---------------------+---------+-------------------------+
| 5 | images/DSC_5494.TIF | 5494 | masks/DSC_5494_mask.tif |
+---+---------------------+---------+-------------------------+
You can create a separate ImageDataGenerator for the masks and then zip it with the existing ImageDataGenerator.
Check out the third example from the documentation .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.