2017-12-30 4 views
0

이미지 분류 모델을 실행 중입니다. 이것은 내가 붙어있는 곳이다. 케라의 버전을 1.0.2로 다운 그레이드하고 스크립트를 다시 실행해도 작동하지 않습니다.keras는 첫 번째 신기원에서 작동하지 않습니다.

/anaconda/envs/py35/lib/python3.5/site-packages/ipykernel/__main__.py:19: UserWarning: Update your `Dense` call to the Keras 2 API: `Dense(101, activation="softmax", kernel_initializer="glorot_uniform", kernel_regularizer=<keras.reg...)` 
/anaconda/envs/py35/lib/python3.5/site-packages/ipykernel/__main__.py:21: UserWarning: Update your `Model` call to the Keras 2 API: `Model(outputs=Tensor("de..., inputs=Tensor("in...)` 
/anaconda/envs/py35/lib/python3.5/site-packages/ipykernel/__main__.py:44: UserWarning: The semantics of the Keras 2 argument `steps_per_epoch` is not the same as the Keras 1 argument `samples_per_epoch`. `steps_per_epoch` is the number of batches to draw from the generator at each epoch. Basically steps_per_epoch = samples_per_epoch/batch_size. Similarly `nb_val_samples`->`validation_steps` and `val_samples`->`steps` arguments have changed. Update your method calls accordingly. 
/anaconda/envs/py35/lib/python3.5/site-packages/ipykernel/__main__.py:44: UserWarning: Update your `fit_generator` call to the Keras 2 API: `fit_generator(<image_gen..., verbose=2, epochs=32, validation_steps=25250, validation_data=<image_gen..., steps_per_epoch=1183, callbacks=[<keras.ca...)` 
Epoch 1/32 

INPUT :

%%time 
from keras.models import Sequential, Model 
from keras.layers import Dense, Dropout, Activation, Flatten 
from keras.layers import Convolution2D, MaxPooling2D, ZeroPadding2D, GlobalAveragePooling2D, AveragePooling2D 
from keras.layers.normalization import BatchNormalization 
from keras.preprocessing.image import ImageDataGenerator 
from keras.callbacks import ModelCheckpoint, CSVLogger, LearningRateScheduler, ReduceLROnPlateau 
from keras.optimizers import SGD 
from keras.regularizers import l2 
import keras.backend as K 
import math 

K.clear_session() 

base_model = InceptionV3(weights='imagenet', include_top=False, input_tensor=Input(shape=(299, 299, 3))) 
x = base_model.output 
x = AveragePooling2D(pool_size=(8, 8))(x) 
x = Dropout(.4)(x) 
x = Flatten()(x) 
predictions = Dense(n_classes, kernel_initializer='glorot_uniform', W_regularizer=l2(.0005), activation='softmax')(x) 





model = Model(input=base_model.input, output=predictions) 

opt = SGD(lr=.01, momentum=.9) 
model.compile(optimizer=opt, loss='categorical_crossentropy', metrics=['accuracy']) 

checkpointer = ModelCheckpoint(filepath='model4.{epoch:02d}-{val_loss:.2f}.hdf5', verbose=1, save_best_only=True) 
csv_logger = CSVLogger('model4.log') 

def schedule(epoch): 
    if epoch < 15: 
     return .01 
    elif epoch < 28: 
     return .002 
    else: 
     return .0004 
lr_scheduler = LearningRateScheduler(schedule) 

model.fit_generator(train_generator, 
        validation_data=test_generator, 
        nb_val_samples=X_test.shape[0], 
        samples_per_epoch=X_train.shape[0], 
        nb_epoch=32, 
        verbose=2, 
        callbacks=[lr_scheduler, csv_logger, checkpointer]) 

답변

0

Jupyter 노트북은 파이썬 3.5

출력 keras 1.2에서 코드를 실행, 처리를 유지하고 첫 번째 시대 이후에 아무것도 실행되지 않습니다 전화에서 verbose = 1으로 시도하면 진행률 표시 줄이 인쇄됩니다. 아마 작동하지만, verbose 매개 변수에 제공된 2의 값으로 인해 에포크 종료 후 한 줄의 출력 만 인쇄됩니다. CPU/GPU 및 데이터 양에 따라 시간이 걸릴 수 있습니다.

+0

아직 작동하지 않았으며 확실히 작동하지 않습니다. 110 기가비트에서 12 코어의 nvidia 파스칼이 있습니다. 메모리 – smk

+0

@smk 어떻게 그 일을하지 않겠습니까? 출력을 생산하기까지 얼마나 오래 기다렸습니까? –

+0

내가 3 시간 동안 기다렸하고 는 또한 노트북 끝에이있어 아무것도 실행 didnt한다 : 1120] 만들기 TensorFlow 장치 : \t를 내가/코어/common_runtime/GPU/gpu_device.cc tensorflow (/ 장치 : GPU : 1) - > (장치 : 1, 이름 : Tesla K80, pci 버스 ID : 5534 : 00 : 00.0, 계산 기능 : 3.7) \t [I 00 : 54 : 05.391 NotebookApp] /image_ai/Untitled.ipynb에 파일 저장 – smk

관련 문제