watsonyanghx / CNN_LSTM_CTC_Tensorflow

CNN+LSTM+CTC based OCR implemented using tensorflow.
MIT License
364 stars 211 forks source link

raise _exceptions.DuplicateFlagError.from_flag #38

Open nithrous opened 5 years ago

nithrous commented 5 years ago

Hi, I try to train but using this cmd command:

main.py --train_dir=../imgs/train/ --val_dir=../imgs/val/ --image_height=60 --image_width=180 --image_channel=1 --out_channels=64 --num_hidden=128 --batch_size=128 --log_dir=./log/train --num_gpus=1 -mode=train

But got this error:

Traceback (most recent call last):
  File "C:\Projects\CNN_LSTM_CTC_Tensorflow\main.py", line 14, in <module>
    import cnn_lstm_otc_ocr
  File "C:\Projects\CNN_LSTM_CTC_Tensorflow\cnn_lstm_otc_ocr.py", line 6, in <module>
    import utils
  File "C:\Projects\CNN_LSTM_CTC_Tensorflow\utils.py", line 43, in <module>
    tf.app.flags.DEFINE_string('log_dir', './log', 'the logging dir')
  File "C:\Users\N1throServer\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\platform\flags.py", line 58, in wrapper
    return original_function(*args, **kwargs)
  File "C:\Users\N1throServer\AppData\Local\Programs\Python\Python37\lib\site-packages\absl\flags\_defines.py", line 241, in DEFINE_string
    DEFINE(parser, name, default, help, flag_values, serializer, **args)
  File "C:\Users\N1throServer\AppData\Local\Programs\Python\Python37\lib\site-packages\absl\flags\_defines.py", line 82, in DEFINE
    flag_values, module_name)
  File "C:\Users\N1throServer\AppData\Local\Programs\Python\Python37\lib\site-packages\absl\flags\_defines.py", line 104, in DEFINE_flag
    fv[flag.name] = flag
  File "C:\Users\N1throServer\AppData\Local\Programs\Python\Python37\lib\site-packages\absl\flags\_flagvalues.py", line 430, in __setitem__
    raise _exceptions.DuplicateFlagError.from_flag(name, self)
absl.flags._exceptions.DuplicateFlagError: The flag 'log_dir' is defined twice. First from absl.logging, Second from utils.  Description from first occurrence: directory to write logfiles into

How can it be fixed?

xywzhht commented 5 years ago

I have encountered the same mistake. Has anyone solved the problem now