zcemycl / TF2DeepFloorplan

TF2 Deep FloorPlan Recognition using a Multi-task Network with Room-boundary-Guided Attention. Enable tensorboard, quantization, flask, tflite, docker, github actions and google colab.
GNU General Public License v3.0
183 stars 60 forks source link

output image is all black #55

Closed SuroshAhmadZobair closed 1 year ago

SuroshAhmadZobair commented 1 year ago

Hi

Thanks for this great repo.

I have tried your pre-trained model to post-process and generate the colorized images for my custom test_set. the image_shape also matches the image you have in the demo. Unfortunately, the output image is all black.

which pre-trained model did I use? https://github.com/zcemycl/TF2DeepFloorplan/issues/36

what command did I use? python -m dfp.deploy --image floorplan.jpg --weight log/store/G --postprocess --colorize --save output.jpg --loadmethod log

Did I try Colab as well? yes, but the result is still the same.

Do I need to fine-tune your pre-trained model on the dataset that you have provided on the repo?

Any help is appreciated. Thanks in advance

zcemycl commented 1 year ago

@SuroshAhmadZobair recently i have not changed back network to use [256,128,64,32] size, so please change it back using #53 , reinstall the package and try it again. I think it would be nice if you fine-tune the model by retraining it from scratch using the tfrecord, and add your test image in the training loop to visualize it in every epoch using tensorboard, please view train.py. So it may show sth different.

The original training set (tfrecord) is quite small like around 200 images, so it does not always yield good result. I have no access to bigger dataset from original author, so thats why the performance might not be as good as the paper suggested .

zcemycl commented 1 year ago

@SuroshAhmadZobair I am guessing you are loading images with range [0,1] instead of [0,255]. Can you try editing the deploy.py? with

img = mpimg.imread(config.image)[:, :, :3]
shp = img.shape
img = tf.convert_to_tensor(img, dtype=tf.uint8)
img = tf.image.resize(img, [512, 512])
img = tf.cast(img, dtype=tf.float32)
img = tf.reshape(img, [-1, 512, 512, 3])
if tf.math.reduce_max(img) > 1.0:
    img /= 255