SamuelMarks / ml-glaucoma

ML programs for glaucoma diagnoses.
https://sydneyscientific.org
4 stars 1 forks source link

Added a training script for resnet50 #7

Closed Shaier closed 5 years ago

Shaier commented 5 years ago

Need to change the training/val/test path to the images. Need to change the ds_dir.

SamuelMarks commented 5 years ago

Latest error from running:

/opt/venvs/tflow3.6/bin/python -m ml_glaucoma v2 train
          -ds bmes
          --data_dir /mnt-lg/tensorflow_datasets
          --model_file /var/repos/ml-glaucoma/ml_glaucoma/model_configs/resnet50.gin
          --model_dir /mnt-lg/ml_glaucoma_models/bmes_resnet50_epochs_13
          --epochs 13

Is:

Epoch 1/13
/opt/venvs/tflow3.6/lib/python3.6/site-packages/keras_applications/resnet50.py:265: UserWarning: The output shape of `ResNet50(include_top=False)` has been changed since Keras 2.2.0.
  warnings.warn('The output shape of `ResNet50(include_top=False)` '
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/venvs/tflow3.6/lib/python3.6/site-packages/ml_glaucoma/__main__.py", line 108, in <module>
    v2_commands[v2_command].build(**kwargs)
  File "/opt/venvs/tflow3.6/lib/python3.6/site-packages/ml_glaucoma/v2_cli/__init__.py", line 41, in build
    return self.build_self(**kwargs)
  File "/opt/venvs/tflow3.6/lib/python3.6/site-packages/ml_glaucoma/v2_cli/__init__.py", line 343, in build_self
    write_images=write_images,
  File "/opt/venvs/tflow3.6/lib/python3.6/site-packages/ml_glaucoma/runners.py", line 116, in train
    initial_epoch=initial_epoch,
  File "/opt/venvs/tflow3.6/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 780, in fit
    steps_name='steps_per_epoch')
  File "/opt/venvs/tflow3.6/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 274, in model_iteration
    batch_outs = f(actual_inputs)
  File "/opt/venvs/tflow3.6/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 3292, in __call__
    run_metadata=self.run_metadata)
  File "/opt/venvs/tflow3.6/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1458, in __call__
    run_metadata_ptr)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [1,32] vs. [1,64]
         [[{{node metrics/precision50/LogicalAnd_1}}]]