awslabs / mxboard

Logging MXNet data for visualization in TensorBoard.
Apache License 2.0
324 stars 47 forks source link

Text logger not working #24

Open leezu opened 6 years ago

leezu commented 6 years ago
In [1]: import mxboard

In [2]: sw = mxboard.SummaryWriter('/tmp/log')

In [3]: sw.add_text('test','test', 0)

In [4]: sw.add_text('test','test', 1)

In [5]: sw.close()

In [6]: sw.flush()

creates the following event file


        7q9     c,A-<A  |F,A*"
 :tesBtestJ

textЪ%6 A*
:tesBtesty:=% 

But tensorboard doesn't show any output

image
szha commented 6 years ago

should flush happen first?

reminisce commented 6 years ago

@szha is right. You need to flush() before close(). In fact, you don't need to flush explicitly as close() would call flush() first before actually closing the file handle. The following code works for me.

from mxboard import SummaryWriter

sw = SummaryWriter('./logs')
sw.add_text('test', 'test', 0)
sw.add_text('test', 'test', 1)
sw.close()
szha commented 6 years ago

Should sw give a warning about flushing to a closed writer?

reminisce commented 6 years ago

A second thought came to me that even close() happened before flush(), the result should have been recorded anyway when close() is called. There shouldn't be empty results on the GUI. I tried the code provided by @leezu and I can see the text logged correctly. Could you please confirm again?

image

leezu commented 6 years ago

The flush in the above code shouldn't have any effect. There is no real reason for it being included above, sorry for the noise.

I still don't get any output in tensorboard, but then it may be related to my version of tensorboard given that it works for you. @reminisce could you upload the event file that you get when running the code?

thomelane commented 6 years ago

Also getting the same issue here @reminisce with the following pip installed packages:

Name: mxnet
Version: 1.2.0

Name: mxboard
Version: 0.1.0

Name: tensorflow
Version: 1.8.0

Name: tensorboard
Version: 1.9.0
thomelane commented 6 years ago

Seems to be an issue with TensorBoard/Tensorflow v1.7 onwards. I don't have an issue with text rendering for TB/TF v1.6.

jiawensong commented 6 years ago

i meet the same problem, which version of tensorflow and tensorboard can work

ThomasDelteil commented 5 years ago

pip install tensorflow==1.6.0 solves it.

chop2 commented 5 years ago

it seems that this issue did not fixed yet. add_text and add_pr_curve in my project did not work correctly. image

image

image

code like this: ` sw = SummaryWriter(logdir='./logs',max_queue=10,flush_secs=5) img = cv2.imread('test.jpg').transpose((2,0,1)) img = np.expand_dims(img,axis=0) sw.add_scalar(tag='gg',value=10,global_step=1) sw.add_image(tag='img',image=img,global_step=0) sw.add_pr_curve('xoxo', np.random.uniform(0,1,100), np.random.uniform(0,1,100),200, 0) sw.add_text(tag='tttt',text='xxxxxdddd',global_step=3)

sw.flush()
sw.close()

`