Coder Social home page Coder Social logo

fk128 / sarcopenia-ai Goto Github PK

View Code? Open in Web Editor NEW
22.0 4.0 14.0 71.61 MB

Code for paper Kanavati, F. et al. (2020). Fully-automated deep learning slice-based muscle estimation from CT images for sarcopenia assessment. arXiv preprint arXiv:2006.06432.

Home Page: https://arxiv.org/abs/2006.06432

License: Other

Dockerfile 0.37% Python 96.82% HTML 2.71% Makefile 0.10%
medical-image-analysis deep-learning ct-slice-detection muscle-estimation sarcopenia-assessment

sarcopenia-ai's Introduction

Sarcopenia AI

Code for papers:

Kanavati, F., Islam, S., Aboagye, E. O., & Rockall, A. (2018). Automatic L3 slice detection in 3D CT images using fully-convolutional networks. arXiv preprint arXiv:1811.09244.

Kanavati, F., Islam, S., Arain, Z., Aboagye, E. O., & Rockall, A. (2020). Fully-automated deep learning slice-based muscle estimation from CT images for sarcopenia assessment. arXiv preprint arXiv:2006.06432.

Models

Trained models for slice detection and slice segmentation are provided in models/

Dev

conda create -y --name sarcopenia-ai python=3.6.2

Install

pip install -e .

Docker

Build docker image

docker build -t sarcopeniaai -f ./Dockerfile .

or make build

Slice detection trainer

Download the training data from here to your data folder.

docker run --rm -it  -v <your_data_folder>:/data -v $(pwd)/configs:/configs sarcopeniaai python -m sarcopenia_ai.apps.slice_detection.trainer --config /configs/slice_detection.cfg

Training output preview on validation images

Segmentation trainer

Labelled segmentation data is not provided. Once you get your own data, you can train a segmentation model with

docker run --rm -it -v <your_data_folder>:/data -v $(pwd)/configs:/configs sarcopeniaai python -m sarcopenia_ai.apps.segmentation.trainer --config /configs/segmentation.cfg

Run as API server

docker run --rm -it -p 5000:5000 sarcopeniaai python -m sarcopenia_ai.apps.server.run_local_server

or make server

Then head to http://localhost:5000 for web UI

You can also get results from command line. Example:

curl -X POST -F image=@data/volume.nii.gz http://localhost:5000/predict

Expected result

{
   "prediction":{
      "id":"64667bf3482d4ee5a0e8af6c67b2fa0d",
      "muscle_area":"520.15",
      "muscle_attenuation":"56.00 HU",
      "slice_prob":"69.74%",
      "slice_z":90,
      "str":"Slice detected at position 90 of 198 with 69.74% confidence "
   },
   "success":true
}

L3 annotated dataset

The dataset was collected from multiple sources:

  1. 3 sets were obtained from the Cancer Imaging Archive (TCIA):

  2. a liver tumour dataset was obtained from the LiTS segmentation challenge.

The dataset is available for download in MIPs format from here.

The subset of transitional vertabrae cases can be downloaded from here.

@article{kanavati2018automatic,
  title={Automatic L3 slice detection in 3D CT images using fully-convolutional networks},
  author={Kanavati, Fahdi and Islam, Shah and Aboagye, Eric O and Rockall, Andrea},
  journal={arXiv preprint arXiv:1811.09244},
  year={2018}
}


@article{kanavati2020fullyautomated,
    title={Fully-automated deep learning slice-based muscle estimation from CT images for sarcopenia assessment},
    author={Fahdi Kanavati and Shah Islam and Zohaib Arain and Eric O. Aboagye and Andrea Rockall},
    year={2020},
    eprint={2006.06432},
    archivePrefix={arXiv},
    primaryClass={eess.IV}
}

sarcopenia-ai's People

Contributors

fk128 avatar notmatthancock avatar

Stargazers

 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  avatar

sarcopenia-ai's Issues

Failed to load the native TensorFlow runtime.

Hi,

I followed the step using docker to install the sarcopenia-ai.

Environment: Mac OS Catalina 10.15.6

I cannot figure out how to use the predict function to perform l3 slice detection.

When I use the suggested method with docker:

docker run --rm -it -p 5000:5000 sarcopeniaai python -m sarcopenia_ai.apps.server.run_local_server

I have the following error message:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: /usr/local/lib/python3.6/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: unsupported version 0 of Verneed record

During handling of the above exception, another exception occurred:

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 "/sarcopenia_ai/sarcopenia_ai/apps/server/run_local_server.py", line 7, in
import tensorflow as tf
File "/usr/local/lib/python3.6/dist-packages/tensorflow/init.py", line 28, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/init.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: /usr/local/lib/python3.6/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: unsupported version 0 of Verneed record

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

TensorFlow version issue

I was attempting to install, and I encountered this problem:
ERROR: Could not find a version that satisfies the requirement tensorflow-gpu==1.14 (from sarcopenia-ai) (from versions: none)
ERROR: No matching distribution found for tensorflow-gpu==1.14

Is there a way to easily update the tensorflow version to fix this?

only train the segmentation model with my own dataset

Thanks for your great tools. I wonder if I can only train the segment model on my own data. Now I have the MRI image .dcm (one slice) and the corresponding label(.tag) file for each patient. What is the format of the input data your model requires for segmentation model training? and how to prepare my dataset to be in line with the format that your model requires.
Should the .dcm image be converted into an array and the label file be converted into .txt? I would really appreciate it if you could show the structure of your training dataset, like the subfolders/ files in the path '/data/images/train/'. Thanks!

midatasets python / Pandas compatibility error

Hello

By doing

docker build -t sarcopeniaai -f ./Dockerfile . 

We get an error because Pandas version is not available for this python version, I think the project was made before the project https://github.com/fk128/midatasets.git specify a version for pandas.

To correct this I specify the last version of midatasets that didn't specify the Pandas version to use, by modifying the Dockerfile like so

FROM tensorflow/tensorflow:1.14.0-gpu-py3

# Quick fix for E: The repository 'https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease' is no longer signed.
RUN rm /etc/apt/sources.list.d/cuda.list
RUN rm /etc/apt/sources.list.d/nvidia-ml.list

RUN apt-get update
RUN apt-get install -y libsm6 libxext6 libxrender-dev
RUN apt-get install -y git
RUN apt-get install -y wget

ADD ./requirements.txt /
RUN pip install -r /requirements.txt
# RUN git clone https://github.com/fk128/midatasets.git && pip install -e midatasets
RUN wget https://github.com/fk128/midatasets/archive/refs/tags/v0.20.0.tar.gz && tar -xzf v0.20.0.tar.gz && pip install -e midatasets-0.20.0/

ADD . /sarcopenia_ai

RUN pip3 install -e /sarcopenia_ai

WORKDIR /sarcopenia_ai

So I added the lines

  • RUN apt-get install -y wget
  • RUN wget https://github.com/fk128/midatasets/archive/refs/tags/v0.20.0.tar.gz && tar -xzf v0.20.0.tar.gz && pip install -e midatasets-0.20.0/

and remove (Comment to be specific ) the line

  • RUN git clone https://github.com/fk128/midatasets.git && pip install -e midatasets

Slice detection training axis error (out of bound)

Dear Fahdi,

My name is Mitch Chen, clinical lecturer in radiology at Imperial collaborating with Andrea. Hope things are going well on your end.

I've been testing out the training part of your slice detection model (with l3_dataset.npy) but have encountered the following error. Just checking if you happen to have across this before or might know a fix.

Thought I'd also ask about prepping a new training dataset (t12_dataset.npy) and wondered if you could offer any more guidance, in addition to what's described in your Clin Rad manuscript.

Feel free to reply to me by email if it suits better ([email protected]).

Thanks,
Rgds,
Mitch


(sarcopenia-ai) mitchchen@oem-System-Product-Name:~/git/sarcopenia-ai$ docker run --runtime=nvidia -t --rm -it -v $(pwd)/data/:/data -v $(pwd)/configs:/configs sarcopeniaai python -m sarcopenia_ai.apps.slice_detection.trainer --config /configs/slice_detection.cfg
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)])
Namespace(batch_size=16, cache_path='/data', cuda_devices='0', dataset_path='/data/l3_dataset.npz', do_augment=True, do_checkpoint=False, do_crossval=0, ds_factor=1, flatten_output=1, image_type='frontal', img_batch_size=1, input_shape=[256, 384, 1], input_spacing=1, mode='heatmap', model_input_shape=[None, None, 1], model_name='CNNLineSep', model_path='/data/slice_detection/', n_splits=3, num_epochs=50, num_val=20, preview_generator_output=1, preview_training_output=1, preview_validation_steps=2, random_state=42, regression_dual_output=False, restart=False, sampling_rate=0.5, sigma=1.5, steps_per_epoch=55, use_cache=1, workers=4)
11:24:19 - tensorflow - WARNING - From /sarcopenia_ai/sarcopenia_ai/core/model_wrapper.py:35: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

11:24:19 - tensorflow - WARNING - From /sarcopenia_ai/sarcopenia_ai/core/model_wrapper.py:39: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

2023-05-26 11:24:19.280154: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2023-05-26 11:24:19.285523: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1
2023-05-26 11:24:19.389436: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-05-26 11:24:19.389875: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x4914a70 executing computations on platform CUDA. Devices:
2023-05-26 11:24:19.389906: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): NVIDIA GeForce RTX 3090, Compute Capability 8.6
2023-05-26 11:24:19.410573: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3593435000 Hz
2023-05-26 11:24:19.414278: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x48b1740 executing computations on platform Host. Devices:
2023-05-26 11:24:19.414306: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): ,
2023-05-26 11:24:19.414628: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-05-26 11:24:19.415028: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties:
name: NVIDIA GeForce RTX 3090 major: 8 minor: 6 memoryClockRate(GHz): 1.8
pciBusID: 0000:41:00.0
2023-05-26 11:24:19.415391: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0
2023-05-26 11:24:19.417109: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcublas.so.10.0
2023-05-26 11:24:19.418606: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcufft.so.10.0
2023-05-26 11:24:19.419014: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcurand.so.10.0
2023-05-26 11:24:19.420227: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusolver.so.10.0
2023-05-26 11:24:19.421002: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusparse.so.10.0
2023-05-26 11:24:19.423156: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7
2023-05-26 11:24:19.423265: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-05-26 11:24:19.423449: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-05-26 11:24:19.423562: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
2023-05-26 11:24:19.423589: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0
2023-05-26 11:24:19.424397: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2023-05-26 11:24:19.424405: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187] 0
2023-05-26 11:24:19.424410: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0: N
2023-05-26 11:24:19.424500: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-05-26 11:24:19.424670: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2023-05-26 11:24:19.424801: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 22803 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce RTX 3090, pci bus id: 0000:41:00.0, compute capability: 8.6)
Resuming training on model_path /data/slice_detection/
l3_dataset
random split
/usr/local/lib/python3.6/dist-packages/imgaug/imgaug.py:184: DeprecationWarning: Function SimplexNoiseAlpha() is deprecated. Use BlendAlphaSimplexNoise instead. SimplexNoiseAlpha is deprecated. Use BlendAlphaSimplexNoise instead. The order of parameters is the same. Parameter 'first' was renamed to 'foreground'. Parameter 'second' was renamed to 'background'.
warn_deprecated(msg, stacklevel=3)
{'model_dir': '/data/slice_detection/', 'config': Namespace(batch_size=16, cache_path='/data', cuda_devices='0', dataset_path='/data/l3_dataset.npz', do_augment=True, do_checkpoint=False, do_crossval=0, ds_factor=1, flatten_output=1, image_type='frontal', img_batch_size=1, input_shape=[256, 384, 1], input_spacing=1, is_multi_gpu=False, mode='heatmap', model_input_shape=[None, None, 1], model_name='CNNLineSep', model_path='/data/slice_detection/', n_splits=3, num_epochs=50, num_gpus=1, num_val=20, preview_generator_output=1, preview_training_output=1, preview_validation_steps=2, random_state=42, regression_dual_output=False, restart=False, sampling_rate=0.5, sigma=1.5, steps_per_epoch=55, use_cache=1, workers=4), 'model': None, 'parallel_model': None, 'name': 'CNNLineSep', 'start_epoch': 0, 'is_multi_gpu': False, 'num_gpus': 1, 'class_mode': 'binary', 'data_loader': <sarcopenia_ai.apps.slice_detection.dataloader.TrainerData object at 0x7efd4920a588>, 'custom_objects': {'GroupNormalization': <class 'sarcopenia_ai.core.layers.GroupNormalization'>}, 'callbacks': [], 'model_input_shape': [None, None, 1], 'max_queue_size': 10, 'workers': 4, 'depth_multiplier': 0.5, 'epochs': 50, 'labels': [], 'steps_per_epoch': 55, 'learning_rate': 0.05, 'compile_args': {'loss': 'binary_crossentropy', 'optimizer': <keras.optimizers.Adam object at 0x7efd49376390>, 'metrics': ['accuracy']}, 'input_shape': [None, None, 1], 'use_multiprocessing': True}
11:24:41 - sarcopenia_ai.core.model_wrapper - INFO - Attempting to load model architecture from file.
11:24:41 - tensorflow - WARNING - 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.

11:24:41 - tensorflow - WARNING - 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.

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

11:28:41 - tensorflow - WARNING - 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.

11:28:41 - tensorflow - WARNING - From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3976: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

11:28:41 - tensorflow - WARNING - From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob.
11:28:42 - sarcopenia_ai.core.model_wrapper - INFO - Model architecture loaded from file.
11:28:42 - sarcopenia_ai.core.model_wrapper - INFO - Loading model weights /data/slice_detection/CNNLineSep_at_epoch_01-checkpoint.h5 ...

11:28:43 - sarcopenia_ai.core.model_wrapper - INFO - Model weights loaded.
11:28:43 - tensorflow - WARNING - 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.

11:28:43 - tensorflow - WARNING - From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/nn_impl.py:180: add_dispatch_support..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

==================================================================================================
input_1 (InputLayer) (None, None, None, 1 0

.... model details .....

Total params: 511,450
Trainable params: 508,058
Non-trainable params: 3,392


None
Epoch 2/50
learning rate 0.1
2023-05-26 11:28:50.540860: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7
48/47 [==============================] - 843s 18s/step - loss: 144634.8605 - acc: 0.0193 - distance: 14000.3229 - val_loss: 2592.5620 - val_acc: 0.9288 - val_distance: 12693.7031
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 "/sarcopenia_ai/sarcopenia_ai/apps/slice_detection/trainer.py", line 167, in
main()
File "/sarcopenia_ai/sarcopenia_ai/apps/slice_detection/trainer.py", line 158, in main
model_wrapper.train_generator()
File "/sarcopenia_ai/sarcopenia_ai/core/model_wrapper.py", line 318, in train_generator
class_weight=self.data_loader.class_weight
File "/usr/local/lib/python3.6/dist-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1418, in fit_generator
initial_epoch=initial_epoch)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/training_generator.py", line 251, in fit_generator
callbacks.on_epoch_end(epoch, epoch_logs)
File "/usr/local/lib/python3.6/dist-packages/keras/callbacks.py", line 79, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/sarcopenia_ai/sarcopenia_ai/apps/slice_detection/callbacks.py", line 38, in on_epoch_end
pred_map = np.expand_dims(zoom(np.squeeze(pred_map), ds), 2)
File "<array_function internals>", line 6, in expand_dims
File "/usr/local/lib/python3.6/dist-packages/numpy/lib/shape_base.py", line 597, in expand_dims
axis = normalize_axis_tuple(axis, out_ndim)
File "/usr/local/lib/python3.6/dist-packages/numpy/core/numeric.py", line 1358, in normalize_axis_tuple
axis = tuple([normalize_axis_index(ax, ndim, argname) for ax in axis])
File "/usr/local/lib/python3.6/dist-packages/numpy/core/numeric.py", line 1358, in
axis = tuple([normalize_axis_index(ax, ndim, argname) for ax in axis])
numpy.AxisError: axis 2 is out of bounds for array of dimension 2

Docker issue with tensorflow

I attempted to use docker but I receive the same issue with the tensorflow version, using conda i have been unable to downgrade to the 1.14.0 version.

-- Error message
=> ERROR [internal] load metadata for docker.io/tensorflow/tensorflow:1. 0.3s

[internal] load metadata for docker.io/tensorflow/tensorflow:1.14.0-gpu-py3:


failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = failed to parse /Users/user1/.docker/.token_seed: unexpected end of JSON input

Empty slice locations in linked data

The README points to the data in the npz here for slice detection. But, it looks like the slice locations in this npz file are all zeros / missing:

>>> data = np.load('.../path_to_imperial_college/l3_dataset_trans.npz', allow_pickle=True)
>>> print([max(v) for v in data['ydata'].item().values()])
[0, 0]

Segmentation

Dear fk128:
Very appreciate to great tool and codes. Beautiful muscle segmentation. Thank you.
Can I use segmentation only (by skipping L3 detection ) ? One slice input would be better.
My data is limited ( no pelvic bone scan .).
Thank you.

No segmentation.cfg

Hi,

I am trying to run the code on a macOS Catalina 10.15.6.

I was able to do create the docker, but when I tried to run it, I got the error message that the segmentation.cfg was not found. Where do I get it from? I don't see it in the repository.

Successfully built 2e5e374233f9 Successfully tagged sarcopeniaai:latest (base) User-MacBook-Air:sarcopenia-ai-master User$ docker run --rm -it -v /Users/Downloads/ -v $(pwd)/configs:/configs sarcopeniaai python -m sarcopenia_ai.apps.segmentation.trainer --config /configs/segmentation.cfg Using TensorFlow backend. Config file does not exists at /configs/segmentation.cfg

little confused about BCELOSS

I'm a little confused about your code. The input in positioning is a view's picture, and the output of the model is a value. How does bceloss work?

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.