weecology / DeepForest

Python Package for Airborne RGB machine learning
https://deepforest.readthedocs.io/
MIT License
515 stars 174 forks source link

Command line to edit config args #456

Open russelldj opened 1 year ago

russelldj commented 1 year ago

Please describe A feature you would like to be added. I think it would be useful to have scripts which perform common tasks and can be run from the command line with arguments. This would save users from re-writing their own scripts or notebooks if they are doing a highly standardized task.

Describe the solution you'd like I would like to have a few scripts that each perform a set of related tasks. The main ones which come to mind are model inference and training. But I think maybe visualization and preprocessing could be helpful as well. Ideally, each script would have a small set of CLI options which would control the behavior. For example, the location of the data or some key algorithm parameters. Each script would presumably be fairly simple because of the modular functions you've already written.

Describe alternatives you've considered None

Additional context I'm going to be writing my own scrips as I work with this codebase. I was mostly curious if you had any recommendations or suggestions for things you'd be interested in me contributing back to this repository.

bw4sz commented 1 year ago

This is part of a larger issue here that we need to address. If there is one argument that we want to supercede the config on file, we should be able to pass a dict to init. Its quite annoying, since some parameters are, such as score_thresh, are only honored when the backbone is created.

If you want to make a pull request, make a branch and edit starting here:

https://github.com/weecology/DeepForest/blob/1f7c9f3138f4b553fb14e49a383a4d9e47ea519f/deepforest/main.py#L52

Step 1 is to allow init to in kwargs for example

m = main.deepforest({"score_thresh":0.5})

and then loop through those kwargs in the location above and assign them to the config file.

Step 2 is to make an argparser to pass either individual named args, which you wrap into a dict, or a perhaps a dict of args (i'm open to either). I imagine most people want to use predict_image or predict_tile, so I can image some simple CLI programs that took in a path argument, loaded either the current bird or tree model, and wrote the image to file.

We could handle these as separate issues, but I think they are conceptually linked in terms of interacting with the API from the command line and the config file.