Closed mlin26 closed 4 months ago
Hello, thank you for using visualkeras! I'll make a fix in 2-3 hours and let you know.
Seems that the last two letters of text are always cut off, no matter the font or font size. I've applied a fix for this in PR #76. I'll apply a cleaner fix once I figure out the root cause. Try installing from source using the command below:
pip install git+https://github.com/paulgavrikov/visualkeras
and run your code again. Let me know if this works for you.
Seems that the last two letters of text are always cut off, no matter the font or font size. I've applied a fix for this in PR #76. I'll apply a cleaner fix once I figure out the root cause. Try installing from source using the command below:
pip install git+https://github.com/paulgavrikov/visualkeras
and run your code again. Let me know if this works for you.
Thanks for your quick reply. Please see the image after using your new code. It seems that in this case it is not totally fixed. The last letter is cut off. Thanks for your help!
Hey, I'm still unable to figure out the root cause of this issue. I'll open up another issue in the Pillow repository, but in the meantime, I'll add an argument which lets you specify an offset for the width of the text, which should prevent the text from being cut off. I'll let you know when I get around to this.
Same here, even after installing the way you suggested @Soontosh Thanks for the help :)
@samuelthomaz7 @mlin26 Just pushed a temporary fix to this bug. You can use the legend_text_spacing_offset
argument in layered_view
to add an offset that increases the width of the space allocated for the text. This stops your legend text from being cut off, if you use the right value (default is 15).
@mlin26 For your use case I found a value of 10 to work well. Example usage:
visualkeras.layered_view(model, legend=True, legend_text_spacing_offset=10).show()
Could you try reinstalling from source and see how your code works now:
pip install git+https://github.com/paulgavrikov/visualkeras
I will keep this issue open for now and update you when I find a full fix (which addresses the root problem).
Thank you so much, it worked :) @Soontosh
@Soontosh Thanks for your update. I am not sure why I got this error for the new argument after pip install and using the code you provided:
layered_view() got an unexpected keyword argument 'legend_text_spacing_offset'
@Soontosh Thanks for your update. I am not sure why I got this error for the new argument after pip install and using the code you provided:
layered_view() got an unexpected keyword argument 'legend_text_spacing_offset'
Could you run the following command and try again?
pip install git+https://github.com/paulgavrikov/visualkeras
Pushed to latest Pypi version (0.1.2)
Found root problem and applied a fix which will be a part of version 1.0.0 - this will be an incompatible API change (in regards to version 0.1.2). Closing this issue!
Hi,
I am trying to run the code. But it seems that the text in the image cannot display correctly. There is some overlap. Can you tell me how to display correctly? Thanks.
I am using: