Adding a New Command-Line Argument

To add another command line arguments one needs to specify it in DeepDIVA/template/CL_arguments.py.

Adding to an Existing Category

There are already several categories of arguments implemented. Each of them has its own method which cluster them, e.g. _general_parameters(). This facilitates finding a specific argument and (most importantly) increases readability and ease maintenance of the code.

Suppose we want to add another parameter for our custom implemented optimizer.

We just need to go into the implementation of _optimizer_options() and add our desired parameter with parser_optimizer.add_argument() method. Refer to other parameters for how to specify it or see directly the documentation of argparse

At this point our parameter will be available in the code as all others deployed by kwargs when not used specifically. See kwargs.

Adding a New Category

If you are implementing a new task or something significantly different from what is already implemented you might find yourself needing many new command line arguments. If these new arguments do not fit in the existing categories you can create a new one. This will facilitate finding a specific argument and (most importantly) increases readability and ease maintenance of the code.

You only need to create your own method _my_new_arguments() in a similar fashion of other categories implemented. Probably the easiest way is to copy and existing one and modifying it.

Then you need to go in parse_arguments() and add a call to your method (you will see the call to all other categories). Just make sure you call your methods before args = parser.parse_args() or it will have no effect.