jocicmarko / ultrasound-nerve-segmentation

Deep Learning Tutorial for Kaggle Ultrasound Nerve Segmentation competition, using Keras
MIT License
939 stars 329 forks source link

submission.csv #32

Open double-flower opened 7 years ago

double-flower commented 7 years ago

Hi, marko, thanks for your sharing. I have run you code, and when i run 'python train.py', after it completed all epoch, there is a warning for all images in /pregs: low contrast image. I ignored the warning, after all the file 'imgs_test_mask.npy' has generated. Then i run 'python submission.py', there is no any errors. but final submission.csv only have the images number, no pixel value. can you help me?

bobbqe commented 6 years ago

Hi @double-flower, did you solve this issue?

mrgloom commented 6 years ago

Something obviously get silently broken.

First of all it don't work in python 3 out-of-the box.

Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 13 2017, 12:02:49) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information

python data.py

Traceback (most recent call last):
  File "data.py", line 92, in <module>
    create_train_data()
  File "data.py", line 19, in create_train_data
    imgs = np.ndarray((total, image_rows, image_cols), dtype=np.uint8)
TypeError: 'float' object cannot be interpreted as an integer

Then fixing one line like total = len(images) // 2 get it work.

Then we get warning:

/home/myuser/anaconda3/lib/python3.6/site-packages/skimage/external/tifffile/tifffile.py:2611: RuntimeWarning: py_decodelzw encountered unexpected end of stream
  strip = decompress(strip)

Not sure if it's harmfull, looks like all images can be opened.

Also I have checked output from model it's in [0,1] range.

And then I found a bug: https://github.com/jocicmarko/ultrasound-nerve-segmentation/blob/master/submission.py#L43 this produce wrong shape and should be img = imgs_test[i,:,:,0]

jocicmarko commented 6 years ago

It's because you're using Python 3.6, and this code was written in Python 2.7, where division operator works differently.

mrgloom commented 6 years ago

Looks like something still broken:

Broken version from master, which produce empty submission.csv Private Score 0.53448 Public Score 0.51031

My version, with fixes. Run using python 3. Private Score 0.31693 Public Score 0.31208

My version, with fixes. Run using python 2. Private Score 0.28902 Public Score 0.29644

My environment:

Python3

Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 13 2017, 12:02:49) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

pip show keras
Name: Keras
Version: 2.1.3
Summary: Deep Learning for humans
Home-page: https://github.com/keras-team/keras
Author: Francois Chollet
Author-email: francois.chollet@gmail.com
License: MIT
Location: /home/myuser/anaconda3/lib/python3.6/site-packages
Requires: scipy, pyyaml, six, numpy

pip show tensorflow-gpu
Name: tensorflow-gpu
Version: 1.4.0
Summary: TensorFlow helps the tensors flow
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /home/myuser/anaconda3/lib/python3.6/site-packages
Requires: enum34, wheel, numpy, tensorflow-tensorboard, six, protobuf

pip show scikit-imageName: scikit-image
Version: 0.13.0
Summary: Image processing routines for SciPy
Home-page: http://scikit-image.org
Author: Stefan van der Walt
Author-email: stefan@sun.ac.za
License: Modified BSD
Location: /home/myuser/anaconda3/lib/python3.6/site-packages
Requires: matplotlib, six, networkx, pillow, PyWavelets

Python2

Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.

pip2 show keras
Name: Keras
Version: 2.1.1
Summary: Deep Learning for Python
Home-page: https://github.com/fchollet/keras
Author: Francois Chollet
Author-email: francois.chollet@gmail.com
License: MIT
Location: /usr/local/lib/python2.7/dist-packages
Requires: pyyaml, six, scipy, numpy
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

pip2 show tensorflow-gpu
Name: tensorflow-gpu
Version: 1.3.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /usr/local/lib/python2.7/dist-packages
Requires: tensorflow-tensorboard, six, protobuf, mock, numpy, backports.weakref, wheel

pip2 show scikit-image
Name: scikit-image
Version: 0.12.3
Summary: Image processing routines for SciPy
Home-page: http://scikit-image.org
Author: Stefan van der Walt
Author-email: stefan@sun.ac.za
License: Modified BSD
Location: /usr/local/lib/python2.7/dist-packages
Requires: dask, six, matplotlib, pillow, networkx, scipy
azizmrr commented 5 years ago

It's because you're using Python 3.6, and this code was written in Python 2.7, where division operator works differently.

How to update it to work for python 3.6 the fastest way?