Unofficial tensorflow implementation of real-time scene image segmentation model "BiSeNet V2: Bilateral Network with Guided Aggregation for Real-time Semantic Segmentation"
Hello! I've found a performance issue in /data_provider: batch() should be called before map(), which could make your program more efficient. Here is the tensorflow document to support it.
Detailed description is listed below:
in /celebamask_hq/celebamask_hq_tf_io.py: dataset.batch(batch_size=batch_size, drop_remainder=True)(line 263) should be called before dataset.map(...)(line 240), dataset = dataset.map(...)(line 245) and dataset = dataset.map(...)(line 250).
in /cityscapes/cityscapes_tf_io.py: dataset.batch(batch_size=batch_size, drop_remainder=True)(line 263) should be called before dataset.map(...)(line 240), dataset.map(...)(line 245) and dataset.map(...)(line 250).
Besides, you need to check the function called in map()(e.g., aug.preprocess_image_for_val called in dataset = dataset.map(map_func=aug.preprocess_image_for_val, num_parallel_calls=CFG.DATASET.CPU_MULTI_PROCESS_NUMS)) whether to be affected or not to make the changed code work properly. For example, if aug.preprocess_image_for_val needs data with shape (x, y, z) as its input before fix, it would require data with shape (batch_size, x, y, z).
Looking forward to your reply. Btw, I am very glad to create a PR to fix it if you are too busy.
Hello! I've found a performance issue in /data_provider:
batch()
should be called beforemap()
, which could make your program more efficient. Here is the tensorflow document to support it.Detailed description is listed below:
dataset.batch(batch_size=batch_size, drop_remainder=True)
(line 263) should be called beforedataset.map(...)
(line 240),dataset = dataset.map(...)
(line 245) anddataset = dataset.map(...)
(line 250).dataset.batch(batch_size=batch_size, drop_remainder=True)
(line 263) should be called beforedataset.map(...)
(line 240),dataset.map(...)
(line 245) anddataset.map(...)
(line 250).Besides, you need to check the function called in
map()
(e.g.,aug.preprocess_image_for_val
called indataset = dataset.map(map_func=aug.preprocess_image_for_val, num_parallel_calls=CFG.DATASET.CPU_MULTI_PROCESS_NUMS)
) whether to be affected or not to make the changed code work properly. For example, ifaug.preprocess_image_for_val
needs data with shape (x, y, z) as its input before fix, it would require data with shape (batch_size, x, y, z).Looking forward to your reply. Btw, I am very glad to create a PR to fix it if you are too busy.