p2irc / deepplantphenomics

Deep learning for plant phenotyping.
GNU General Public License v2.0
135 stars 46 forks source link

Random Seed Option #47

Closed donovanlavoie closed 4 years ago

donovanlavoie commented 4 years ago

This adds the option to set a random seed to enable reproducible results from the main sources of randomness: train/test/val masks, augmentations, and dataset shuffling.

The only addition to the model itself was the setter set_random_seed, which takes an integer and uses it as a seed to the RNGs for Python itself (random, used for mask shuffling), Numpy (np.random, used bygraph_extract_patch), and Tensorflow (tf.random, used for dataset shuffling, augmentations, and dropout layers).

Some tests were also added to verify the reproducible nature of each of the main randomness sources. These tests make the assumption that we reproduction matters across different graphs and sessions; a graph & session are made for a model with a seed when a program is run, and then the program is run again, making a new copy of the same graph & session with the same seed.

The test suite w/ additions run and the examples should still run fine.

jubbens commented 4 years ago

Is there documentation for setting the random seed?