Bartzi / stn-ocr

Code for the paper STN-OCR: A single Neural Network for Text Detection and Text Recognition
https://arxiv.org/abs/1707.08831
GNU General Public License v3.0
499 stars 137 forks source link

plot_log not matched the log file format #2

Closed yangxiuwu closed 7 years ago

yangxiuwu commented 7 years ago

the actual log file content has 4 columns, as following: 2017-08-25 10:54:04,722 Node[0] Epoch[0] Batch [50] Speed: 106.29 samples/sec Accuracy=0.204000 Loss=2.318700 but parse_log_file only process 3 columns. and event_info = re.search(r'.-(?P.)=(?P.)', info) not matched the log output, there is not a '-' before the event_name. I correct it by modify if len(line_splits) == 3 to if len(line_splits) == 4 and erase the '.-' but I got an error when plotting. the error was: 'for metric, axe in zip(metrics_to_plot, axes): TypeError: zip argument #2 must support iteration'

(Pdb) print(metrics_to_plot) ['Accuracy'] (Pdb) print(axes) Axes(0.125,0.11;0.775x0.77)

Bartzi commented 7 years ago

Oh that is quite interesting, you say that one line in your log file contains information about accuracy and loss at once? It basically should not for the script that is included in the repository.

This actually leads me to the following question: Which version of MXNet are you using? When I check the code of the speedometer extension in the current version of MXNet, I see that this handles the plotting completely different.

In order to use plot_log.py with the current version of MXNet you will need to change the parsing of the log file. Right now the parser assumes that each metric is logged in its own line in the log file. With the new version, each line consists of all logged metrics. So the parsing code needs to be aware of that.

So you can either change your MXNet version to the one I pointed out in the README, or you change the log parsing, so that it fits to your MXNet version ;)

yangxiuwu commented 7 years ago

Thanks a lot, It's my fault. I used the newest version of MXNet. I has changed the version to 0.9.3,then the log output was matched the log file parser: 2017-08-25 23:08:51,610 Node[0] Epoch[0] Batch [50] Speed: 225.11 samples/sec Train-Accuracy=0.206000. Another question, what's means of label 10 in the file train.csv?It's only for placeholder or other meaning? Thanks again.

Bartzi commented 7 years ago

glad to hear that it helped you ;)

Regarding your label question: Normally SVHN only has 10 labels. That means we would use labels from 0-9, but we also need a blank label for aligning all inputs andusing inputs with a varying length of numbers in one training batch. This is why we used 11 labels for training svhn. You can have a look at this file. This file maps each class/label to its corresponding character code. As you can see label 0 is in this case the blank label as it maps to this unicode character, that we used as blank label for our training.

yangxiuwu commented 7 years ago

I got it, thanks