MobileNetV2는 사전 훈련된 모델의 경우 기본적으로 1000개의 클래스를 분류할 수 있습니다123. 이는 ImageNet 데이터셋을 기반으로 훈련되었기 때문이며, ImageNet은 1000개의 클래스로 구성되어 있습니다45.
기본 설정
MobileNetV2의 기본 구현에서는 다음과 같은 설정을 가집니다:
- ImageNet 사전 훈련 모델: 1000개 클래스16
- Hugging Face 모델: 실제로는 1001개 클래스 (추가 “배경” 클래스 포함)2
- 기본 입력 크기: 224×224×3 픽셀78
커스텀 클래스 개수 설정
MobileNetV2는 전이 학습을 통해 이론적으로 제한 없이 다양한 개수의 클래스로 분류할 수 있습니다. 실제 사용 예시들을 보면:
소규모 분2개 클래스: 바이너리 분류 (남성/여성 고양이 분류)910
프레임워크별 구현 방법:
PyTorch:
pythonimport torchvision.models as models
# 10개 클래스로 설정
model = models.mobilenet_v2(num_classes=10)
# 또는 사전 훈련된 모델의 분류기 수정
model = models.mobilenet_v2(pretrained=True)
model.classifier[1] = nn.Linear(1280, 10)
Keras/TensorFlow:
pythonfrom keras.applications import MobileNetV2
# 커스텀 클래스 개수로 설정
model = MobileNetV2(classes=num_classes, weights=None)
# 또는 사전 훈련된 모델 활용
base_model = MobileNetV2(weights='imagenet', include_top=False)
# 커스텀 분류 레이어 추가
실제 제한 사항
MobileNetV2의 클래스 개수에 대한 실질적인 제한은 다음과 같습니다:
- 메모리 제약: 클래스 수가 증가하면 최종 Dense 레이어의 파라미터가 증가11
- 데이터 요구량: 클래스가 많을수록 각 클래스당 충분한 훈련 데이터 필요
- 하드웨어 성능: 모바일 기기에서의 추론 속도 고려
따라서 MobileNetV2는 기본적으로 1000개 클래스를 분류하도록 설계되었지만, 전이 학습을 통해 2개부터 수천 개까지 다양한 개수의 클래스로 분류하도록 조정할 수 있습니다. 실제 적용 시에는 사용 목적과 하드웨어 제약을 고려하여 적절한 클래스 개수를 선택하는 것이 중요합니다.
- https://wn42.tistory.com/47
- https://huggingface.co/docs/transformers/en/model_doc/mobilenet_v2
- https://keras.io/api/applications/mobilenet/
- https://deeplearning.cms.waikato.ac.nz/user-guide/class-maps/IMAGENET/
- https://resources.wolframcloud.com/NeuralNetRepository/resources/MobileNet-V2-Trained-on-ImageNet-Competition-Data/
- https://docs.openvino.ai/2023.3/omz_models_model_mobilenet_v2.html
- https://pythontutorials.eu/deep-learning/image-classification/
- https://stackoverflow.com/questions/65153063/how-can-mobilenetv2-have-the-same-number-of-parameters-for-different-custom-inpu/65417467
- https://pythontutorials.eu/deep-learning/transfer-learning/
- https://stackoverflow.com/questions/67751080/unable-to-modify-mobilenet-model-for-2-class-classification
- https://pmc.ncbi.nlm.nih.gov/articles/PMC11679759/table/sensors-24-08052-t004/
- https://www.kaggle.com/code/utkarshsaxenadn/fruit-classification-mobilenetv2-acc-95
- https://www.youtube.com/watch?v=EHkbznaB2rY
- https://stackoverflow.com/questions/57285224/fine-tuning-pretrained-model-mobilenet-v2-in-pytorch
- https://stackoverflow.com/questions/58667646/i-tried-to-train-an-image-classifier-based-on-mobilenetv2-but-loss-has-not-been
- https://discuss.pytorch.org/t/fine-tune-mobilenet-v2/52140
- https://roboflow.com/model/mobilenet-v2-classification
- https://scisharp.github.io/Keras.NET/api/Keras.Applications.MobileNet.MobileNetV2.html
- https://velog.io/@pre_f_86/MobileNet-V2-%EB%85%BC%EB%AC%B8-%EB%A6%AC%EB%B7%B0
- https://discuss.pytorch.org/t/adding-layers-to-mobilenetv2/86393
- https://gaussian37.github.io/dl-concept-mobilenet_v2/
- https://huggingface.co/docs/transformers/v4.37.1/model_doc/mobilenet_v2
- https://ech97.tistory.com/entry/MobileNetV2
- https://github.com/w5688414/Keras-MobileNetV2-Image-classification
- https://stackoverflow.com/questions/69983272/mobilenetv2-is-giving-good-results-during-training-and-validation-but-when-test
- https://velog.io/@sour_grape/%EC%9D%8C%EC%95%85-%EB%B6%84%EB%A5%98-%EB%94%A5%EB%9F%AC%EB%8B%9D%EC%9D%84-%EB%A7%8C%EB%93%A4%EC%9E%9014-mobileNetV2-%EA%B5%AC%ED%98%84
- https://www.kaggle.com/code/matthewweisberg/98-3-accuracy-mobilenetv2-transfer-learning
- https://mvcv.tistory.com/23
- https://hyunhp.tistory.com/372
- https://www.sciencedirect.com/topics/computer-science/mobilenetv2
- https://way24.tistory.com/31
- https://github.com/justinliu23/mobilenetv2-transfer-learning
- https://blog.csdn.net/weixin_45377629/article/details/124667666
- https://blog.roboflow.com/how-to-train-mobilenetv2-on-a-custom-dataset/
- https://cocalc.com/github/leechanwoo-kor/coursera/blob/main/deep-learning-specialization/course-4-convolutional-neural-network/Transfer_learning_with_MobileNet_v1.ipynb
- https://github.com/dusty-nv/jetson-inference/issues/585
- https://www.youtube.com/watch?v=c-S7AtUTnFU
- https://www.kaggle.com/code/mgiraygokirmak/mobilenetv2
- https://stackoverflow.com/questions/50918521/train-mobilnet-v2-with-transfer-learning-in-tensorflow
- https://tensorflow.rstudio.com/reference/keras/application_mobilenet_v2.html
- https://www.mdpi.com/2071-1050/15/3/1906
- https://github.com/tonylins/pytorch-mobilenet-v2/blob/master/README.md
- https://mmpretrain.readthedocs.io/en/latest/api/generated/mmpretrain.models.backbones.MobileNetV2.html
- https://pytorch.org/vision/main/models/generated/torchvision.models.mobilenet_v2.html
- https://stackoverflow.com/questions/78688705/mobilenetv2-transfer-learning
- https://paperswithcode.com/sota/image-classification-on-imagenet
- https://pytorch.org/vision/2.0/models/generated/torchvision.models.quantization.mobilenet_v2.html
- https://github.com/keras-team/keras-applications/issues/169
- https://stackoverflow.com/questions/69812600/pretrained-cnn-mobilenet-v2-output-shape
- https://docs.pytorch.org/vision/stable/_modules/torchvision/models/mobilenetv2.html
- https://github.com/d-li14/mobilenetv2.pytorch
답글 남기기