Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical issues with training code #28

Open
ThisIsIsaac opened this issue Nov 4, 2019 · 2 comments · May be fixed by #29
Open

Critical issues with training code #28

ThisIsIsaac opened this issue Nov 4, 2019 · 2 comments · May be fixed by #29

Comments

@ThisIsIsaac
Copy link
Contributor

  1. training scripts (trainSyndata.py) imports test.py. test.py has some code not nested in if __name__ == "__main__":. For example, this below code that parses argument:
    parser = argparse.ArgumentParser(description='CRAFT Text Detection')
    parser.add_argument('--trained_model', default='weights/craft_mlt_25k.pth', type=str, help='pretrained model')
    parser.add_argument('--text_threshold', default=0.7, type=float, help='text confidence threshold')
    parser.add_argument('--low_text', default=0.4, type=float, help='text low-bound score')
    parser.add_argument('--link_threshold', default=0.4, type=float, help='link confidence threshold')
    parser.add_argument('--cuda', default=True, type=str2bool, help='Use cuda to train model')
    parser.add_argument('--canvas_size', default=2240, type=int, help='image size for inference')
    parser.add_argument('--mag_ratio', default=2, type=float, help='image magnification ratio')
    parser.add_argument('--poly', default=False, action='store_true', help='enable polygon type')
    parser.add_argument('--show_time', default=False, action='store_true', help='show processing time')
    parser.add_argument('--test_folder', default='/data/', type=str, help='folder path to input images')

is part of test.py and it is not within if __name__ == "__main__":. This means whenever test.py is imported, this code runs. You can see the error with:

python trainSyndata.py --help

which prints

usage: trainSyndata.py [-h] [--trained_model TRAINED_MODEL]
                       [--text_threshold TEXT_THRESHOLD] [--low_text LOW_TEXT]
                       [--link_threshold LINK_THRESHOLD] [--cuda CUDA]
                       [--canvas_size CANVAS_SIZE] [--mag_ratio MAG_RATIO]
                       [--poly] [--show_time] [--test_folder TEST_FOLDER]

CRAFT Text Detection

optional arguments:
  -h, --help            show this help message and exit
  --trained_model TRAINED_MODEL
                        pretrained model
  --text_threshold TEXT_THRESHOLD
                        text confidence threshold
  --low_text LOW_TEXT   text low-bound score
  --link_threshold LINK_THRESHOLD
                        link confidence threshold
  --cuda CUDA           Use cuda to train model
  --canvas_size CANVAS_SIZE
                        image size for inference
  --mag_ratio MAG_RATIO
                        image magnification ratio
  --poly                enable polygon type
  --show_time           show processing time
  --test_folder TEST_FOLDER
                        folder path to input images

The above print statement is for args written in test.py, not for trainSyndata.py. Nesting the arguments within the if statement in test.py fixed the error.

  1. watershed.py uses Polygon library, but I can't seem to find how to install this library. Any hints?
ThisIsIsaac added a commit to ThisIsIsaac/CRAFT-Reimplementation that referenced this issue Nov 4, 2019
@ThisIsIsaac ThisIsIsaac linked a pull request Nov 4, 2019 that will close this issue
@ThisIsIsaac
Copy link
Contributor Author

  1. watershed.py uses Polygon library, but I can't seem to find how to install this library. Any hints?

pip install Polygon3


Made PR to address each issue, respectively:
#29
#30

@backtime92
Copy link
Owner

@ThisIsIsaac thanks for you advice I will merge it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants