Code Monkey home page Code Monkey logo

covid-caps's People

Contributors

parnianafshar avatar shahinshh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

covid-caps's Issues

When I try to run the code with a different dataset I get unwanted results.

Using TensorFlow backend.
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
tcmalloc: large alloc 1204224000 bytes == 0x57dc000 @  0x7fcf4464c1e7 0x7fcf421725e1 0x7fcf421db90d 0x7fcf421dc522 0x7fcf42273bce 0x50a7f5 0x50cfd6 0x507f24 0x509c50 0x50a64d 0x50cfd6 0x507f24 0x509c50 0x50a64d 0x50c1f4 0x507f24 0x50b053 0x634dd2 0x634e87 0x63863f 0x6391e1 0x4b0dc0 0x7fcf44249b97 0x5b26fa
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:74: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:517: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:174: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:181: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

2020-08-08 22:27:04.973016: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-08-08 22:27:04.975812: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2200000000 Hz
2020-08-08 22:27:04.975982: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2594a00 executing computations on platform Host. Devices:
2020-08-08 22:27:04.976009: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
2020-08-08 22:27:04.993713: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:1834: The name tf.nn.fused_batch_norm is deprecated. Please use tf.compat.v1.nn.fused_batch_norm instead.

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3980: The name tf.nn.avg_pool is deprecated. Please use tf.nn.avg_pool2d instead.

WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
input_1 (InputLayer)         (None, None, None, 3)     0         
_________________________________________________________________
conv2d_1 (Conv2D)            (None, None, None, 64)    1792      
_________________________________________________________________
batch_normalization_1 (Batch (None, None, None, 64)    256       
_________________________________________________________________
conv2d_2 (Conv2D)            (None, None, None, 64)    36928     
_________________________________________________________________
average_pooling2d_1 (Average (None, None, None, 64)    0         
_________________________________________________________________
conv2d_3 (Conv2D)            (None, None, None, 128)   73856     
_________________________________________________________________
conv2d_4 (Conv2D)            (None, None, None, 128)   147584    
_________________________________________________________________
reshape_1 (Reshape)          (None, None, 128)         0         
_________________________________________________________________
capsule_1 (Capsule)          (None, 32, 8)             32768     
_________________________________________________________________
capsule_2 (Capsule)          (None, 32, 8)             2048      
_________________________________________________________________
capsule_3 (Capsule)          (None, 2, 16)             256       
_________________________________________________________________
lambda_1 (Lambda)            (None, 2)                 0         
=================================================================
Total params: 295,488
Trainable params: 295,360
Non-trainable params: 128
_________________________________________________________________
Not using data augmentation.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_grad.py:1250: add_dispatch_support.<locals>.wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
Train on 2000 samples, validate on 241 samples
Epoch 1/100
2020-08-08 22:27:07.765238: W tensorflow/core/framework/allocator.cc:107] Allocation of 201867264 exceeds 10% of system memory.
2020-08-08 22:27:07.967568: W tensorflow/core/framework/allocator.cc:107] Allocation of 201867264 exceeds 10% of system memory.
2020-08-08 22:27:07.967568: W tensorflow/core/framework/allocator.cc:107] Allocation of 201867264 exceeds 10% of system memory.
2020-08-08 22:27:08.485600: W tensorflow/core/framework/allocator.cc:107] Allocation of 198246400 exceeds 10% of system memory.
tcmalloc: large alloc 1784520704 bytes == 0x89d4c000 @  0x7fcf4464c1e7 0x7fcf2d855804 0x7fcf2fa61e34 0x7fcf3009ddbb 0x7fcf3009fb9c 0x7fcf300c57d1 0x7fcf300ca212 0x7fcf300cab11 0x7fcf2969ed94 0x7fcf29691050 0x7fcf2973c6d4 0x7fcf2973b544 0x7fcf42f2ea50 0x7fcf440106db 0x7fcf44349a3f
2020-08-08 22:27:10.457322: W tensorflow/core/framework/allocator.cc:107] Allocation of 184090624 exceeds 10% of system memory.
  16/2000 [..............................] - ETA: 25:53 - loss: nan - acc: 1.0000tcmalloc: large alloc 1784520704 bytes == 0x9e30c000 @  0x7fcf4464c1e7 0x7fcf2d855804 0x7fcf2fa61e34 0x7fcf3009ddbb 0x7fcf3009fb9c 0x7fcf300c57d1 0x7fcf300ca212 0x7fcf300cab11 0x7fcf2969ed94 0x7fcf29691050 0x7fcf2973c6d4 0x7fcf2973b544 0x7fcf42f2ea50 0x7fcf440106db 0x7fcf44349a3f
  32/2000 [..............................] - ETA: 23:56 - loss: nan - acc: 1.0000tcmalloc: large alloc 1784520704 bytes == 0x9db26000 @  0x7fcf4464c1e7 0x7fcf2d855804 0x7fcf2fa61e34 0x7fcf3009ddbb 0x7fcf3009fb9c 0x7fcf300c57d1 0x7fcf300ca212 0x7fcf300cab11 0x7fcf2969ed94 0x7fcf29691050 0x7fcf2973c6d4 0x7fcf2973b544 0x7fcf42f2ea50 0x7fcf440106db 0x7fcf44349a3f
  48/2000 [..............................] - ETA: 23:14 - loss: nan - acc: 1.0000tcmalloc: large alloc 1784520704 bytes == 0x97f98000 @  0x7fcf4464c1e7 0x7fcf2d855804 0x7fcf2fa61e34 0x7fcf3009ddbb 0x7fcf3009fb9c 0x7fcf300c57d1 0x7fcf300ca212 0x7fcf300cab11 0x7fcf2969ed94 0x7fcf29691050 0x7fcf2973c6d4 0x7fcf2973b544 0x7fcf42f2ea50 0x7fcf440106db 0x7fcf44349a3f
  64/2000 [..............................] - ETA: 22:48 - loss: nan - acc: 1.0000

Hey, Thank you for the amazing implementation of Capsule Network. I tried using the code with a different dataset containing COVID-19 CT samples. And in the starting only I get acc = 1.0000.

Can you help me up with this?

No source for reproducing x_train.npy,y_train.npy and valid.npy

Hello,

  1. I managed to get pretrained data and use it as described in your repository
  2. I inspected your github repository and process the data according to the source of COVID-NET, but the output is data/test and data/train, however in your code you use
    x_train= np.load("x_train.npy")
    y_train= np.load("y_train.npy")>=3
    x_valid= np.load("x_valid.npy")

I did my best, but couldn't find a way to transform the output of COVID-NET into the npy arrays.
Please help me to clarify it.

Thanks.

Cannot construct pre-training dataset

Hi,

  1. Downloaded the images from https://nihcc.app.box.com/v/ChestXray-NIHCC/folder/37178474737 using batch_download_zips.py
  2. As instructed in https://github.com/ShahinSHH/COVID-CAPS/tree/master/database, extracted each zip archive to its corresponding directory database/images_0**/
  3. Ran xray14_preprocess.py. This created database_preprocessed which contains images.
  4. Ran xray14_selection.py. This created X_image.npy (which I renamed as X_images.npy) and Y_labels.npy.
  5. Ran pre-train.py, which gives the following error:
Traceback (most recent call last):
  File "pre-train.py", line 142, in <module>
    x = Capsule(32, 8, 3, True)(x)  
  File "/home/arda/Programs/py3_envs/tfenv/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 842, in __call__
    outputs = call_fn(cast_inputs, *args, **kwargs)
  File "/home/arda/Programs/py3_envs/tfenv/lib/python3.7/site-packages/tensorflow_core/python/autograph/impl/api.py", line 237, in wrapper
    raise e.ag_error_metadata.to_exception(e)
ValueError: in converted code:

    pre-train.py:109 call  *
        b = keras.backend.batch_dot(o, hat_inputs, [2, 3])
    /home/arda/Programs/py3_envs/tfenv/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:1496 batch_dot  *
        raise ValueError('Can not do batch_dot on inputs with shapes ' +

    ValueError: Can not do batch_dot on inputs with shapes (None, 32, 32, 8) and (None, 32, None, 8) with axes=[2, 3]. x.shape[2] != y.shape[3] (32 != 8).

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.