logo

Aiex.ai

4 Mins Read

Classify Broken and Normal Bones in X-ray Images using deep learning

X-ray Images

Classify Broken and Normal Bones in X-ray Images using Deep Learning

X-ray is a type of radiation that passes through the body. The dense parts of the body such as bones show up as clear white areas on the image and softer parts where X-ray can pass through more easily, such as your heart & lungs, show up as darker areas.  In adults, a bone fracture appears dark black, or darker than the rest of the bone and is visible like a shady area on a bright white bone. Bones are a significant component of the human body and bone fractures are common. Doctors use X-ray images to diagnose a fractured bone. Nowadays with the help of computer vision technology and image processing, we can classify broken and normal bone X-ray images with high accuracy. For this project, we will use deep neural networks to develop a classification model that can detect fractured and healthy bones in X-ray images.

X-ray image
Figure1. X-ray image. Source

What is classification?

A Classification model is a program that learns how to assign a label (or class) to input data. Classification belongs to the category of supervised learning where the model is trained with images and their classes as input to predict labels for new images. In this project, we use binary classification which refers to classification tasks with two class labels. The ‘0’ label is assigned to the broken bone class and ‘1’ represents the normal bone class. Classification algorithms are evaluated based on their results. There are different evaluation metrics but we will use 3 of them for this project.

Accuracy

Accuracy is a popular and simple metric used to evaluate the performance of a model based on the predicted labels.

accuracy

Precision

Precision is the ratio of True Positives to all the positives predicted by the model. The more false positives the model predicts, the lower its precision will be.

precision

Recall

Recall is the ratio of true positives to all the positives in your dataset. The more false negatives the model predicts, the lower its recall will be.

recall

Project Steps

For this project, I am using the AIEX platform. I will do everything from data collection to model testing on this platform. First, we should create a new classification project

Gathering Images

I couldn’t find an available dataset in the desired format so I collected the X-ray images for each class (broken and normal bone) myself. We can use the AIEX platform’s image search engine and choose a class (click on picture classification) as shown below.

After selecting the images, we will check them again. If everything looks good, we will mark the images as Ready to Train.

Preprocessing & Augmentation

It’s time to apply data augmentation to our dataset because I don’t have many images for each class. I applied a Horizontal augmentation to 50% of my training images.

Training

AIEX platform supports several different frameworks, I chose the MOBILE NET model from each framework and tried it on my dataset

Training result

Framework Model name Accuracy % Recall % Precision %
NVIDIA TAO EFFICIENTNETB1RELU 64 65 71
TENSORFLOW INCEPTION 90 66 79
PYTORCH SQUEEZENET 76 76 76
TFLITE  EFFICIENTNET 80

Deploy

This is the fun part—trying out the model, and seeing how well it works. I took a new photo and tested it using the deployment section.

deep learning
Figure2. a) NVIDAI TAO inference results, b) TENSORFLOW inference results, c) PYTORCH inference results, d) TFLITE inference results

Summary

In this project, we went over what you need to do to build a classification model from data collection to model testing on the AIEX platform.

A few points about the results of our trained models:

1- Expanding the training dataset by collecting more images for each class, will significantly improve the model’s performance.

2- It is best to try several sets of Hyperparameter values to find the best values for each model and project.

Related articles
waste management
This article discusses the integration of artificial intelligence in the field of recycling. We will also train a model...
traffic management
As urban areas continue to grow, the number of vehicles on the road is increasing, which leads to congested...
Brake-Pad-Quality-Control-with-Artificial-Intelligence
Thanks to advancements in artificial intelligence, particularly in computer vision, deep learning models can now be utilized in various...
Trauma Detection on Pelvic Radiographs using Computer Vision Algorithms
A timely and accurate diagnosis of the proximal femur and pelvis injuries in trauma patients is essential to saving...
Defect-Detection-in-Metal-Parts-using-Optical-Systems
Detecting and classifying aesthetic defects in different sizes, shapes, and positions immediately after the casting process is an essential...
Annotating Computer Vision Projects
Choosing the right images for training, validating, and testing computer vision algorithms will significantly affect your AI project's success....
Subscribe to our newsletter and get the latest practical content.

You can enter your email address and subscribe to our newsletter and get the latest practical content. You can enter your email address and subscribe to our newsletter.