Metastatic Adenocarcinoma Classification With Lobe

Andrew A Borkowski
The Startup
Published in
5 min readNov 9, 2020

--

No coding machine learning in practice, part 1

Machine learning (ML) has the potential for numerous applications in the health care field. One promising application is in the area of anatomic pathology. ML allows representative images to be used to train a computer to recognize patterns from labeled photographs. Based on a set of images selected to represent a specific tissue or disease process, the computer can be trained to evaluate and recognize new and unique images from patients and render a diagnosis.

Lung and colon adenocarcinoma are some of the most common cancers affecting numerous patients throughout the world. They frequently spread to other sites of the body. It is not uncommon that the pathologist is faced with the question if biopsy showing adenocarcinoma originated from lung or colon primary site. Pathologists are often forced to use special stains to help them make this determination.

I used two different machine learning libraries (fastai and Keras) to solve the origin of metastatic adenocarcinoma in my previous Medium post. In the current article, I use Lobe, an automatic machine learning application, to decipher this important problem.

Lobe is a free desktop application that you can use to train your models and export them for production. It is available for both Windows and macOS operating systems. You can download it from the lobe.ai website. As of November 2020, the app is in beta version. You can now only use the Lobe application for image classification, but the developer promises to expand the app to more machine learning problems in the future.

Lobe is a welcome newcomer to the AutoML applications. It is another major desktop-based AutoML app after the Apple CreateML. The vast majority of AutoML applications are cloud-based. The major advantage of desktop AutoML apps is data security, which is especially important for medical data. Last year I published an article comparing Apple CreateML and Google AutoML for histopathologic cancer diagnosis. I addressed the pros and cons of local versus cloud machine learning applications. Since Apple CreateML is only available for macOS, it is great to see that Lobe is available for both Windows and macOS platforms. To make it even better, the developers promise a Linux version as well.

Once you open Lobe, you are presented with a welcoming screen.

Next, you import images. If your images are organized in class-labeled folders, you can drag and drop them into the application. That way, you don’t have to label images. Otherwise, you will need to label images manually.

I used images from the LC25000 dataset. Unfortunately, I could not train all 10000 images. The app just crashed. Everything worked fine once I downsized the dataset to 2000 images (1000 for each class, lung adenocarcinoma, and colon adenocarcinoma respectively).

The Lobe application lets you choose to optimize project settings for accuracy or speed. The underlying engine of Lobe is transfer learning with TensorFlow. If you choose accuracy, the program is using ResNet50V2 for training, which provides better results but takes longer to train. If you optimize for speed, the program uses MobileNetV2, which is a faster but less accurate choice.

First, I optimized the training for speed. It took 8 minutes to train the model. After the training, the model accurately classified 98 % of images.

Next, I optimized the training for accuracy. It took 12 minutes to train the model. After the training, the model accurately classified 99 % of images.

The program’s biggest downside is the lack of GPU support. All training is CPU based. Once again, the developer promises to provide it in the future.

Below is the activity monitor using fast/less accurate option:

And the activity monitor using slower/more accurate option:

The program automatically divides the dataset into an 80% training dataset and a 20% testing dataset. You can see the results for the testing dataset by going to View and choosing Test Images.

Next, I validated the trained model on 20 unknown images by choosing the Play button and dragging images into the program.

The model correctly predicted 9 out of 10 (90%) of colon adenocarcinoma images.

The model correctly predicted 10 out of 10 (100%) of lung adenocarcinoma images.

After training, you can export your model for the web, mobile or local use.

In summary, I am really impressed with the beta version of Lobe. It is effortless to use and requires no coding skills for model training and model export for production. Although not as versatile as Apple CreateML, it may become a formidable competitor in the future due to operating system independence. The current biggest shortcomings are lack of GPU support and narrow ML problem type choice limited to image classification. I especially appreciate a vibrant Reddit Lobe Community with a responsive Lobe developer team. With a competent developer team and adequate financing by the parent company Microsoft, Lobe has great potential to compete with other AutoML platforms successfully.

Thank you for taking the time to read this post.

Andrew

@tampapath

--

--