【LightWeight】Understanding EfficientNet+EfficientDet paper w/ code
- 논문1 : EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks / Youtube Link
- 논문2 : EfficientDet: Scalable and Efficient Object Detection / Youtube Link
- 분류 : LightWeight
- 저자 : Mingxing Tan, Ruoming Pang, Quoc V. Le
- 읽는 배경 : Recognition Basic. Understand confusing and ambiguous things.
- 읽으면서 생각할 포인트 : 코드와 함께 최대한 완벽히 이해하기. 이해한 것 정확히 기록해두기.
- 느낀점 :
목차
1. EfficientNet from youtube
2. lukemelas/EfficientNet-PyTorch
Github-Link : EfficientNet-PyTorch
EfficientNet은 a family of image classification models 이다. Based on MnasNet in term of AutoML, Compound Scaling.
Simply, Model 불러와 Classification 수행하기
import json from PIL import Image import torch from torchvision import transforms from efficientnet_pytorch import EfficientNet model = EfficientNet.from_pretrained('efficientnet-b0') # 0. Preprocess image tfms = transforms.Compose([transforms.Resize(224), transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),]) img = tfms(Image.open('img.jpg')).unsqueeze(0) print(img.shape) # torch.Size([1, 3, 224, 224]) # 0. Load ImageNet class names labels_map = json.load(open('labels_map.txt')) # 이미 EfficientNet-Pytorch/examples/simple/labels_map.txt 있다. labels_map = [labels_map[str(i)] for i in range(1000)] # 1. For Classify model.eval() with torch.no_grad(): outputs = model(img) # 2. For Feature Extractor features = model.extract_features(img) print(features.shape) # torch.Size([1, 1280, 7, 7])
Pytorch Efficient-Net model Code
3. EfficientDet from youtube
4. zylo117/Yet-Another-EfficientDet-Pytorch
- Github Link : Yet-Another-EfficientDet-Pytorch
- 핵심 EfficientDet model 구현 부분 : Yet-Another-EfficientDet-Pytorch/efficientdet/model.py