This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
janni_tutorial [2019/09/16 09:35] twagner [Training a model for your data] |
janni_tutorial [2020/09/24 14:45] twagner [Training a model for your data] |
||
---|---|---|---|
Line 4: | Line 4: | ||
[[https:// | [[https:// | ||
- | JANNI can be used a command line tool but also provides an simple interface to be integrated into other programs. | + | Besides |
==== Download and Installation ==== | ==== Download and Installation ==== | ||
Line 15: | Line 15: | ||
</ | </ | ||
- | You can use JANNI either by command line or with the GUI. Typically, most users prefer to use the GUI (but we will also provide the command line commands in this tutorial). You can start the GUI with | + | You can use JANNI either by command line or with the GUI. Typically, most users prefer to use the GUI (but we will also provide the command line commands in this tutorial). You can start the GUI with: |
< | < | ||
janni_denoise.py | janni_denoise.py | ||
</ | </ | ||
- | The GUI is basically | + | The GUI is essentially |
{{ :: | {{ :: | ||
Line 29: | Line 29: | ||
* **denoise**: | * **denoise**: | ||
- | Each action has several parameters which are organized in tabs. Once you chosen your settings you can press “Start”, the command will be applied and JANNI shows you the output: | + | Each action has several parameters which are organized in tabs. Once you chosen your settings you can press "Start," and the command will be applied and JANNI shows you the output: |
{{ : | {{ : | ||
- | It will tell you when something | + | It will tell you if something |
==== Training a model for your data ==== | ==== Training a model for your data ==== | ||
- | In case you want to use the general model ([[janni# | + | In case you want to use the general model ([[janni# |
- | In case you would like to train a model for your data, the first thing you have to do is to create | + | In case you would like to train a model for your data, you need to copy a few movie files into a separate directory. We typically use at least 30 movies (unaligned) to train the model. Fewer might also work, but more often work much better. Its recommended to copy movies from different data collections into different folders. If you later water do denoise binned micrographs, |
- | ===== Configuration | + | <note important> |
+ | ** Setup binning ** | ||
+ | In case your movies are superresolution and you later want to apply it to binned micrographs, | ||
+ | </ | ||
+ | |||
+ | The next thing you have to do is to create a configuration file for JANNI. | ||
+ | |||
+ | === Configuration === | ||
In the GUI choose the action " | In the GUI choose the action " | ||
{{ :: | {{ :: | ||
- | Press "start" and the config will be written in the specified // | + | Press "Start," and the config |
+ | <hidden **Generate the configuration file with the command line**> | ||
+ | If you would like to use the command line, you can get a description of all parameters with: | ||
+ | < | ||
+ | janni_denoise.py config -h | ||
+ | </ | ||
- | | + | The following command will create |
- | < | + | <code> |
- | { | + | janni_denoise.py |
- | " | + | |
- | " | + | |
- | " | + | |
- | }, | + | |
- | + | ||
- | " | + | |
- | "movie_dir": | + | |
- | " | + | |
- | "odd_dir": | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | } | + | |
- | } | + | |
</ | </ | ||
+ | </ | ||
- | The fields | + | === Training === |
- | * **architecture**: | + | In principle, you simply |
- | * **patch_size**: | + | |
- | * **movie_dir**: | + | |
- | * **even_dir**: | + | |
- | * **odd_dir**: | + | |
- | * **batch_size**: | + | |
- | * **learning_rate**: | + | |
- | * **nb_epoch**: | + | |
- | * **saved_weights_name**: | + | |
- | In principle you only have to adapt the paths. The other could keep as they are. | + | |
- | We typically use at least 30 movies (unaligned) to train the model. Less might also work, more work often much better. | + | |
+ | {{: | ||
+ | |||
+ | Press " | ||
+ | |||
+ | <hidden **Run the training with the command line**> | ||
To run the training on gpu 0: | To run the training on gpu 0: | ||
< | < | ||
janni_denoise.py train config.json -g 0 | janni_denoise.py train config.json -g 0 | ||
</ | </ | ||
+ | </ | ||
==== Denoise ==== | ==== Denoise ==== | ||
- | With a trained model (either trained by you or the general model) you can directly denoise either your movies or averages. In our experience, denoising the motion corrected averages works better. | + | With a trained model (either |
+ | {{ :: | ||
- | To denoise a set if images you have to tell JANNI three **mandatory** arguments: | + | You might also want to change the GPU ID in //Optional arguments// tab. Then, press the //Start// button. JANNI will denoise your images at roughly 1s per micrograph. |
- | - //input_path//: This path points to the directory with your images. | + | |
- | - // | + | |
- | - //model_path//: This path points to the model you want to use (the .h5 file). | + | |
- | As model you can either use the model you trained for your data or the general model ([[janni# | + | < |
- | + | In case you need a description | |
- | There are couple of **optional** parameters that you use: | + | < |
- | * **%%-ol%%**: | + | janni_denoise.py denoise |
- | * **%%-bs%%**: | + | </code> |
- | * **%%-g%%**: GPU ID to run JANNI on. Multiple GPUs are not supported yet. | + | |
- | + | ||
- | Here is now how you do the actual denoising: | + | |
- | It is assumed that you run the command in a directory with your model file '' | + | |
- | The following command will run the denoising on GPU 0: | + | The following command will run the denoise the images in ''/ |
< | < | ||
- | janni_denoise.py | + | janni_denoise.py |
</ | </ | ||
+ | </ | ||
+ | |||
+ | |||