Multilayer Model(毕设总结)

本文探讨了一种多层次模型在复杂生物分类如鸟类家族到物种级别的应用,通过结合粗粒度标签(如家族和属)与深度卷积神经网络(CNN),改善了分类效果。实验中使用了MobileNet作为基线模型,对比了更新浅层权重和固定浅层权重两种策略的效果,发现后者可能引入类似正则化的效应,有助于解决过拟合问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Multilayer Model

1.Introduction

As classification in creature is more and more complicate(like Family to Species) , According to [1] the convolutional neural network(CNN) also extract coarse information in the shallow layer and extract specially detail in more deep layers. So I propose a multilayer model that considering the family and genus label from meta_data.

here’s what I thought.
在这里插入图片描述

The shallow model will be initialized by coarse label like family and genus. Then I will connect these shallow cnn layer with deep cnn layer to predict the target. Considering the feature space of family,genus,genus is different, I recommend use some transfer method to map feature in a similar distribution.

In addition usually We use STFT(Short Time Fourier Transform) to get spectrum , limiting to the fixed window size, STFT cannot completely reflect high-frequency and low-frequency information at the same time. So I think it is may useful encoder the temporal data into the model. However I don’t do relative work.

2.Experiment

2.1 Pytorch: accelerate training by prefetching data

Reference:tianws.github

LIMITATION: MUST CHECK YOUR GPU OCCUPANCY

if your GPU occupancy occur a periodic loop from low to high, it is your io speed limits your training. So it will be useful by doing prefetching.

Requires

prefetch_generator

INSTALL: pip install prefetch_generator


# make sure designated workers always have at least 1 additional data item loaded
# Uing DataLoaderX inplace of torch.utils.data.DataLoader
class DataLoaderX(DataLoader):
    def __iter__(self):
        return BackgroundGenerator(super().__iter__())
    
# Defining your own dataset
class YourOwndataset(torch.utils.data.Dataset)
....
....

# Defining a class to get the batch data 
class DataPrefetcher():
# if you want to make forward propagation and loading data working in parallel
# SHOULD MAKE A NEW CUDA STREAM
    def __init__(self, loader, opt='cuda'):
        self.loader = iter(loader)
        self.opt = opt
        self.stream = torch.cuda.Stream()
        self.preload()

    def preload(self):
        try:
            self.batch = next(self.loader)
        except StopIteration:
            # it will end automatically when full dataset loaded 
            self.batch = None
            return

        with torch.cuda.stream(self.stream):
            for k in self.batch:
                if k != 'meta':
                    self.batch[k] = self.batch[k].to(device=self.opt, non_blocking=True)

    def next(self):
        torch.cuda.current_stream().wait_stream(self.stream)
        batch = self.batch
        self.preload()
        return batch
#---------------------------------------------------------------------------------------#
# Get your batch 
prefetcher = DataPrefetcher(YourOwndataset,opt)
batch = prefetcher.next()

2.2 Model and Result

Using MobileNet[3] as basic model.

Here’s my basic accuracy result, the experiment is finished in June, back to that time I didn’t know that accuracy actually can give as much information as I think, so the result is not completed. However I do not want to continue this program cause I choose different work in my master , the most important reason is that I cannot finish this work by alone

Dataset&Modelbasic modelweight Updatedweight Fixed
Three Genus42.2%43.4%39.2%
Ten Genus31.2%32.9%33.1%

Anyway Let’s see the result, I proposed two way which is updating the shallow layer weight and fixing the shallow layer weight respectively. We can see there is improvement though all the accuracy is not good enough.

And here’s training fig of ten genus bird dataset.

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Fig: basic model(left) weight updated model(center) weight fixed model(right), Cross-entropy Loss training schemes. It shows model cannot convex well(I don’t know why) but from the peak values may the weight fixed model get a function like regularization.

3 Summary

No question there is a lot of bugs to fix. But this is my undergraduation design. Hope someone will get a better idea from this. Following are some opinion I think should be done.

Work

  • Use bigger dataset
  • Fix the overfitting problem
  • Using transfer learning to make the combination between shallow and deep model more better(robust?).

Target

  • Using mutilayer model to fix the data unbalanced problem(trained by normal species, predict rare species)

Reference

  • [1] Zeiler M D, Fergus R. Visualizing and understanding convolutional networks[C]//European conference on computer vision. Springer, Cham, 2014: 818-833.
  • [2] https://tianws.github.io/skill/2019/08/27/gpu-volatile/
  • [3] Howard A G, Zhu M, Chen B, et al. Mobilenets: Efficient convolutional neural networks for mobile vision applications[J]. arXiv preprint arXiv:1704.04861, 2017.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值