Towards AI Can Help your Team Adopt AI: Corporate Training, Consulting, and Talent Solutions.

Publication

Custom Network with Resnet, Densenet, Inception blocks
Latest   Machine Learning

Custom Network with Resnet, Densenet, Inception blocks

Last Updated on July 20, 2023 by Editorial Team

Author(s): Akula Hemanth Kumar

Originally published on Towards AI.

Making computer vision easy with Monk, low code Deep Learning tool and a unified wrapper for Computer Vision.

Have you ever thought of experimenting to build a network with different blocks from Resnet, Densenet, Inception, etc?

I am assuming that you are already familiar with the basics of computer vision. Before diving into it, make sure you know what’s Resnet, what’s Densenet, and what’s Inception.

Let’s get started

Table of Contents

  1. Installation
  2. Load Data
  3. Create and debug network
  4. Train

Installation

Install Monk, a low code Deep Learning tool and a unified wrapper for Computer Vision.

$git clone https://github.com/Tessellate-Imaging/monk_v1.git#Select the requirements file as per OS and CUDA version$cd monk_v1/installation/Linux && pip install -r requirements_cu9.txt

Load Data

Here we are using Stanford Dogs classification dataset.

$! wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1b4tC_Pl1O80of7U-PJ7VExmszzSX3ZEM' -O- U+007C sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1b4tC_Pl1O80of7U-PJ7VExmszzSX3ZEM" -O dogs-species-dataset.zip && rm -rf /tmp/cookies.txt

Create and debug network

Here we create a network and append resnet_v1_block and resnet_v2_block.

Debug Custom Model

$ gtf.debug_custom_model_design(network);
View From Bottom to Top

Next, we will append resnet_v1_bottleneck_block and resnet_v2_bottleneck_block

Debug Custom Model

$ gtf.debug_custom_model_design(network);
View From Bottom to Top

Here we will append densenet_block, inception_a_block and inception_c_block.

Debug Custom Model

$ gtf.debug_custom_model_design(network);
View From Bottom to Top

we flatten, add a fully connected layer, and followed by a fully-connected layer with a number of neurons(units) = number of classes in your custom dataset.

Debug Custom Model

$ gtf.debug_custom_model_design(network);
View From Bottom to Top

Visualize with Netron

Train

Set Epochs, Optimizer, losses and learning rate schedulers.

You can find the complete jupyter notebook on Github.

If you have any questions, you can reach Abhishek and Akash. Feel free to reach out to them.

I am extremely passionate about computer vision and deep learning. I am an open-source contributor to Monk Libraries.

You can also see my other writings at:

Akula Hemanth Kumar – Medium

Read writing from Akula Hemanth Kumar on Medium. Computer vision enthusiast. Every day, Akula Hemanth Kumar and…

medium.com

Photo by Hector Falcon on Unsplash

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI

Feedback ↓