SlideShare a Scribd company logo
Submit Search
Upload
The rod of Asclepios: Machine learning in Python for cardiac image analysis, Jan Margeta
Report
Pôle Systematic Paris-Region
Pôle Systematic Paris-Region
Follow
•
1 like
•
423 views
1
of
37
The rod of Asclepios: Machine learning in Python for cardiac image analysis, Jan Margeta
•
1 like
•
423 views
Download Now
Download to read offline
Report
Technology
PyParis 2017 http://pyparis.org
Read more
Pôle Systematic Paris-Region
Pôle Systematic Paris-Region
Follow
Recommended
Sparse Isotropic Hashing
Ikuro Sato
8.3K views
•
28 slides
Deep learning for FinTech
geetachauhan
843 views
•
22 slides
Why Neurons have thousands of synapses? A model of sequence memory in the brain
Numenta
1.4K views
•
29 slides
RNN Explore
Yan Kang
2.7K views
•
80 slides
Overview of Genome Assembly Algorithms
Ntino Krampis
13.6K views
•
29 slides
Neural network and deep learning Devfest17
Issam AlZinati
249 views
•
42 slides
More Related Content
Similar to The rod of Asclepios: Machine learning in Python for cardiac image analysis, Jan Margeta
Facial expression recognition projc 2 (3) (1)
AbhiAchalla
245 views
•
40 slides
Ai for life sciences - are we ready
Jack C Crawford
291 views
•
42 slides
Value chain maps for open source ecosystems
Chris Corriere
235 views
•
47 slides
machine learning in the age of big data: new approaches and business applicat...
Armando Vieira
2.5K views
•
82 slides
Introduction to Deep learning
Massimiliano Patacchiola
290 views
•
22 slides
Neural Networks
Eric Su
2.6K views
•
21 slides
Similar to The rod of Asclepios: Machine learning in Python for cardiac image analysis, Jan Margeta
(20)
Facial expression recognition projc 2 (3) (1)
AbhiAchalla
•
245 views
Ai for life sciences - are we ready
Jack C Crawford
•
291 views
Value chain maps for open source ecosystems
Chris Corriere
•
235 views
machine learning in the age of big data: new approaches and business applicat...
Armando Vieira
•
2.5K views
Introduction to Deep learning
Massimiliano Patacchiola
•
290 views
Neural Networks
Eric Su
•
2.6K views
Designing a neural network architecture for image recognition
ShandukaniVhulondo
•
83 views
Think Machine Learning with Scikit-Learn (Python)
Chetan Khatri
•
513 views
An introduction to AI (artificial intelligence)
Bellaj Badr
•
1.8K views
"From IA to AI in Healthcare" - Walter De Brouwer (CEO/Founder, doc.ai/Scanadu)
Hyper Wellbeing
•
633 views
CIS AIML Beginners Series Part 1
Council Of Information Security
•
681 views
II-SDV 2017: The Next Era: Deep Learning for Biomedical Research
Dr. Haxel Consult
•
3.1K views
Data Science.pptx
TrainerAnalogicx
•
4 views
Internship - Python - AI ML.pptx
Hchethankumar
•
107 views
Internship - Python - AI ML.pptx
Hchethankumar
•
22 views
Transfer Leaning Using Pytorch synopsis Minor project pptx
Ankit Gupta
•
168 views
Python for Data Science with Anaconda
Travis Oliphant
•
8K views
Introduction to Deep Learning
Oleg Mygryn
•
574 views
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
pythoncharmers
•
7K views
Artificial Intelligence
Rk King
•
1.5K views
More from Pôle Systematic Paris-Region
OSIS19_IoT :Transparent remote connectivity to short-range IoT devices, by Na...
Pôle Systematic Paris-Region
686 views
•
39 slides
OSIS19_Cloud : SAFC: Scheduling and Allocation Framework for Containers in a ...
Pôle Systematic Paris-Region
293 views
•
24 slides
OSIS19_Cloud : Qu’apporte l’observabilité à la gestion de configuration? par ...
Pôle Systematic Paris-Region
349 views
•
38 slides
OSIS19_Cloud : Performance and power management in virtualized data centers, ...
Pôle Systematic Paris-Region
288 views
•
27 slides
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
Pôle Systematic Paris-Region
271 views
•
30 slides
OSIS19_Cloud : Attribution automatique de ressources pour micro-services, Alt...
Pôle Systematic Paris-Region
229 views
•
9 slides
More from Pôle Systematic Paris-Region
(20)
OSIS19_IoT :Transparent remote connectivity to short-range IoT devices, by Na...
Pôle Systematic Paris-Region
•
686 views
OSIS19_Cloud : SAFC: Scheduling and Allocation Framework for Containers in a ...
Pôle Systematic Paris-Region
•
293 views
OSIS19_Cloud : Qu’apporte l’observabilité à la gestion de configuration? par ...
Pôle Systematic Paris-Region
•
349 views
OSIS19_Cloud : Performance and power management in virtualized data centers, ...
Pôle Systematic Paris-Region
•
288 views
OSIS19_Cloud : Des objets dans le cloud, et qui y restent -- L'expérience du ...
Pôle Systematic Paris-Region
•
271 views
OSIS19_Cloud : Attribution automatique de ressources pour micro-services, Alt...
Pôle Systematic Paris-Region
•
229 views
OSIS19_IoT : State of the art in security for embedded systems and IoT, by Pi...
Pôle Systematic Paris-Region
•
349 views
Osis19_IoT: Proof of Pointer Programs with Ownership in SPARK, by Yannick Moy
Pôle Systematic Paris-Region
•
204 views
Osis18_Cloud : Pas de commun sans communauté ?
Pôle Systematic Paris-Region
•
659 views
Osis18_Cloud : Projet Wolphin
Pôle Systematic Paris-Region
•
231 views
Osis18_Cloud : Virtualisation efficace d’architectures NUMA
Pôle Systematic Paris-Region
•
202 views
Osis18_Cloud : DeepTorrent Stockage distribué perenne basé sur Bittorrent
Pôle Systematic Paris-Region
•
233 views
Osis18_Cloud : Software-heritage
Pôle Systematic Paris-Region
•
133 views
OSIS18_IoT: L'approche machine virtuelle pour les microcontrôleurs, le projet...
Pôle Systematic Paris-Region
•
264 views
OSIS18_IoT: La securite des objets connectes a bas cout avec l'os et riot
Pôle Systematic Paris-Region
•
488 views
OSIS18_IoT : Solution de mise au point pour les systemes embarques, par Julio...
Pôle Systematic Paris-Region
•
169 views
OSIS18_IoT : Securisation du reseau des objets connectes, par Nicolas LE SAUZ...
Pôle Systematic Paris-Region
•
93 views
OSIS18_IoT : Ada and SPARK - Defense in Depth for Safe Micro-controller Progr...
Pôle Systematic Paris-Region
•
248 views
OSIS18_IoT : RTEMS pour l'IoT professionnel, par Pierre Ficheux (Smile ECS)
Pôle Systematic Paris-Region
•
248 views
PyParis 2017 / Un mooc python, by thierry parmentelat
Pôle Systematic Paris-Region
•
2.5K views
Recently uploaded
Green Leaf Consulting: Capabilities Deck
GreenLeafConsulting
170 views
•
18 slides
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst
389 views
•
80 slides
.conf Go 2023 - Data analysis as a routine
Splunk
76 views
•
12 slides
ChatGPT and AI for Web Developers
Maximiliano Firtman
152 views
•
82 slides
Throughput
Moisés Armani Ramírez
28 views
•
11 slides
MemVerge: Gismo (Global IO-free Shared Memory Objects)
CXL Forum
108 views
•
16 slides
Recently uploaded
(20)
Green Leaf Consulting: Capabilities Deck
GreenLeafConsulting
•
170 views
Empathic Computing: Delivering the Potential of the Metaverse
Mark Billinghurst
•
389 views
.conf Go 2023 - Data analysis as a routine
Splunk
•
76 views
ChatGPT and AI for Web Developers
Maximiliano Firtman
•
152 views
Throughput
Moisés Armani Ramírez
•
28 views
MemVerge: Gismo (Global IO-free Shared Memory Objects)
CXL Forum
•
108 views
Microchip: CXL Use Cases and Enabling Ecosystem
CXL Forum
•
107 views
MemVerge: Past Present and Future of CXL
CXL Forum
•
105 views
The Research Portal of Catalonia: Growing more (information) & more (services)
CSUC - Consorci de Serveis Universitaris de Catalunya
•
51 views
JCon Live 2023 - Lice coding some integration problems
Bernd Ruecker
•
61 views
Samsung: CMM-H Tiered Memory Solution with Built-in DRAM
CXL Forum
•
96 views
Liqid: Composable CXL Preview
CXL Forum
•
118 views
Combining Orchestration and Choreography for a Clean Architecture
ThomasHeinrichs1
•
64 views
"AI Startup Growth from Idea to 1M ARR", Oleksandr Uspenskyi
Fwdays
•
23 views
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
Splunk
•
75 views
.conf Go 2023 - Many roads lead to Rome - this was our journey (Julius Bär)
Splunk
•
172 views
MemVerge: Memory Viewer Software
CXL Forum
•
115 views
"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur
Fwdays
•
35 views
AI: mind, matter, meaning, metaphors, being, becoming, life values
Twain Liu 刘秋艳
•
28 views
AMD: 4th Generation EPYC CXL Demo
CXL Forum
•
117 views
The rod of Asclepios: Machine learning in Python for cardiac image analysis, Jan Margeta
1.
The rod of Asclepios Jan Margeta | | jan@kardio.me @jmargeta
2.
World full of superpowers
3.
Python as our superpower? Meet Asclepios
4.
Hi, I am Jan Pythonista for 8 years Founder of KardioMe Maker of tools to better understand our hearts Python 3.5+, numpy, MxNet, Keras, Tensorflow, scikit-learn, SimpleITK, pydicom, Flask, Sanic, Django, PostgreSQL, ReactJS, Docker
5.
This talk Peek into our hearts with medical images What used to be hard is now magically simple Tricks and tools for machine learning in Python we've learned along the way
6.
Imaging of our hearts X-Ray ultrasound fluoroscopy computed tomography
magnetic resonance Kelly 2007 Carmo et al. 2010 Arnold et al. 2008 Foley et al. 2010 Vanezis et al. 2011
7.
What a human sees
8.
What a human sees
9.
What a computer sees
10.
Machine learning Solving problems with data prediction = model.predict (data)
11.
Image recognition in 6 lines of code from keras.applications import imagenet_utils from keras.applications.vgg16 import VGG16 # Load and prepare input images images_raw = load_images() images = imagenet_utils.preprocess_input(images_raw) # Load a pretrained image classification model model = VGG16(include_top=True, weights='imagenet') # Do the prediction predictions = model.predict(images)
12.
Convolutional neural networks By Aphex34
13.
Finding the right image representation
14.
Excellent for natural images Trained on Imagenet large scale visual recognition challenge dataset 10 million images, 1000 categories
15.
Extracting visual features # Load a pretrained classification model source_model = VGG16(weights='imagenet') # Define feature extractor from one layer of the network feature_layer = source_model.get_layer('conv4') feature_extractor = Model( input=fix_model.input, output=feature_layer.output) # Extract features features = feature_extractor.predict(images) See also "Deep visualization toolbox" on youtube
16.
Using the extracted features with scikit-learn from sklearn.svm import LinearSVC def flatten_features(features): return features.reshape(len(features), -1) features_train = feature_extractor.predict(images_train) features_train = flatten_features(features_train) classifier = LinearSVC() classifier.fit(features_train, labels_train) # predict on never seen images features_test = feature_extractor.predict(images_test) features_test = flatten_features(features_test) prediction_test = classifier.predict(features_test)
17.
Example: Cardiac view recognition , Joint work with and Margeta et al. 2015 Inria
Microsoft Research Cambridge
18.
Train the model from scratch from keras.models import Sequential from keras.layers import Conv2D, Dense, Flatten images_train, labels_train = load_data() shape = (64, 64, 1) model = Sequential([ Conv2D(32, (3, 3), activation='relu', input_shape=shape), MaxPooling2D(pool_size=(2, 2)) Flatten(), Dense(4, activation='softmax'), ])
19.
# Loss function - task dependent # high for bad parameters, low for good ones # e.g. for image recognition loss_function = 'sparse_categorical_crossentropy' # Compile the model and fit model.compile(loss=loss_function, optimizer='adam') model.fit(images_train, labels_train) # Save the model for reuse model.save('model.h5')
20.
Let's save some time for our radiologists , Joint work with and KardioMe Inria
IHU Liryc
21.
Deploy as a web service see also Tensorflow-serving and Kubernetes
22.
Expose the model with Flask* *do not run in production, it requires a bit more love than this import keras from flask import Flask, jsonify, request app = Flask(__name__) model = keras.models.load_model('model.h5') @app.route('/predict', methods=['POST']) def predict(): image_batch = request_to_numpy(request) y = model.predict(image_batch) prediction = convert_prediction(y) return jsonify(output=prediction) app.run(port=5000, threaded=False)
23.
Run with the same conditions as when it was built
24.
Define the Dockerfile FROM python:3.5 RUN mkdir -p /usr/src/app COPY server.py /usr/src/app/ COPY model.h5 /usr/src/app/ COPY requirements.txt /usr/src/app/ WORKDIR /usr/src/app RUN pip install -r requirements.txt EXPOSE 5000 CMD python server.py
25.
Build the Docker container Run the service Call the service docker build -t kardiome/model-pyparis . docker run -d -p 5000:5000 kardiome/model-pycon curl -X POST -F 'image=@/data/im.png' localhost:5000/predict
26.
Tips to improve your machine learning today
27.
Iterate fast Minimally viable model
28.
One metric to rule them all Training progress visualisation in Tensorboard
29.
Visualize everything Built with Sanic backend (like Flask) and React
30.
Progress with confidence and repeatable pipelines Gitlab's continuous integration is an excellent start for simple pipelines (see Airflow, Luigi, Joblib, Flink)
31.
No glory in data preparation But it must be done
32.
Having a small dataset? Do something about it https://affinelayer.com/pixsrv/
33.
Got unlabeled data? Don't be lazy, just annotate it if you can, there are tools to help you See in Scikit-learn , Joint work with and Margeta et al. 2015
Inria Microsoft Research Cambridge Label Propagation example
34.
Be practical Have an open mind
35.
Overall experience Remarkable ecosystem Fantastic community Build things very hard before ★★★★★
36.
Takeaways Build something you care about Poke your models and learn from them Pick your superpower and have fun # to fly import antigravity
37.
The rod of Asclepios Jan Margeta | | Thanks! Python, numpy, MxNet, Keras, Tensorflow, scikit-learn, SimpleITK, pydicom, Flask, Sanic, Django, PostgreSQL, ReactJS, Docker Inria, IHU Liryc, Microsoft Research jan@kardio.me @jmargeta