Keras 19

텐서플로우 Dataset: from_generator 설명

사용 이유 1. 메모리 용량의 한계 때문에 - 이미지, 텍스트 데이터 등을 메모리에 올려 놓은 후 작업을 진행할 수 있지만, 수많은 파일이 있을 경우 이를 모두 메모리에 올려놓지 못하기에, generator로부터 1개 또는 배치단위만큼 파일을 불러와야 합니다. 2. 다양한 가공 처리를 위해서 - 간혹 이미지 채널을 기존 RGB 3채널에서 4,5 채널로 늘리는 경우 또는 이미지의 특정 부분을 자른다거나 겹치게 하는 등의 다양한 처리를 generator를 통해서 할 수 있기 때문입니다. 필수 사항 1. 모델의 Input shape, Output shape 2. generator: 이미지와 해당 라벨을 추출하는 제너레이터 3. 모델에 넣을 데이터의 자료형과 라벨의 자료형(Int, Float, String 등)..

Tensorflow 2020.11.03

케라스 Conv-LSTM을 활용한 영상 예측 예제

Keras 예제 번역: Next-frame prediction with Conv-LSTM Next-frame prediction with Conv-LSTM Author: jeammimi Date created: 2016/11/02 Last modified: 2020/05/01 Description: Conv-LSTM을 활용해, sequence의 다음 프레임을 예측해봅시다. Source: keras.io/examples/vision/conv_lstm/ colab.research.google.com/github/keras-team/keras-io/blob/master/examples/vision/ipynb/conv_lstm.ipynb github.com/keras-team/keras-io/blob/maste..

Tensorflow 2020.11.03

케라스 예제 번역: Simple MNIST convnet

Simple MNIST convnet 간단한 Convolutional Network를 활용하여 MNIST 데이터셋 분류 모델 만들기 Author: fchollet Date created: 2015/06/19 Last modified: 2020/04/21 Description: A simple convnet that achieves ~99% test accuracy on MNIST. Setup # 라이브러리 로드 import numpy as np from tensorflow import keras from tensorflow.keras import layers Prepare the data # 클래스 개수 및 input_shape 지정하기 num_classes = 10 input_shape = (28, 2..

Tensorflow 2020.11.03

Keras 이미지 Extract features 및 Feature map 그리기

1. 이미지 features 추출하고, Feature map을 그리기. (with VGG16) keras.io/api/applications/#extract-features-with-vgg16 from tensorflow.keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing import image from tensorflow.keras.applications.vgg16 import preprocess_input import matplotlib.pyplot as plt model = VGG16(weights='imagenet', include_top=False) # include_top = False를 하면 Flatten하기 전..

Tensorflow 2020.10.29

Tensorflow 케라스 EfficientNet Finetuning 예제 - 1

Image classification via fine-tuning with EfficientNet Author: Yixing_Fu Date created: 2020/06/30 Last modified: 2020/07/16 Description: imagenet으로 pretrained된 EfficientNet의 Weights를 활용한 Stanford Dogs Classification - Keras - Colab - Github Introduction: what is EfficientNet 2019년 [Tan_and_Le]에 의해 처음 소개된 EfficientNet은 imagenet 분류와 전이학습을 통한 보통의 이미지 분류 모두에서 가장 높은 정확도에 도달한 효율적인 모델입니다. (i.e. requiri..

Tensorflow 2020.10.28

Tensorflow: input_tensor와 input_shape의 차이

tf.keras.applications.InceptionV3( include_top=True, weights="imagenet", input_tensor=None, input_shape=None, pooling=None, classes=1000, classifier_activation="softmax", ) input_shape: 입력받는 이미지의 shape input_tensor: 입력층의 tensor 지정. 입력받는 이미지의 shape에 관계없이 특정 tensor로 지정할수 있음. 공식문서: input_shape will be ignored if the input_tensor is provided 예를 들어, input_shape를 (224, 224, 3)으로 하고 input_tensor을 지정하지 ..

Tensorflow 2020.10.28

텐서플로우 콜백 함수(tensorflow callback)

https://keras.io/api/callbacks/ Keras documentation: Callbacks API Callbacks API A callback is an object that can perform actions at various stages of training (e.g. at the start or end of an epoch, before or after a single batch, etc). You can use callbacks to: Write TensorBoard logs after every batch of training to moni keras.io 콜백함수가 필요한 이유: 모델이 학습을 시작하면 학습이 완료될 때까지 사람이 할 수 있는게 없습니다. 따라서 이를 해..

Tensorflow 2020.05.16