def extract_features(directory, sample_count):
    features = np.zeros(shape=(sample_count, 4, 4, 512))
    labels = np.zeros(shape=sample_count)
    generator = datagen.flow_from_directory(directory, target_size=(150, 150), batch_size=batch_size, class_mode='binary')
    i = 0
    for (inputs_batch, labels_batch) in generator:
        features_batch = conv_base.predict(inputs_batch)
        features[(i * batch_size):((i + 1) * batch_size)] = features_batch
        labels[(i * batch_size):((i + 1) * batch_size)] = labels_batch
        i += 1
        if ((i * batch_size) >= sample_count):
            break
    return (features, labels)
def extract_features(directory, sample_count):
    features = np.zeros(shape=(sample_count, 4, 4, 512))
    labels = np.zeros(shape=sample_count)
    generator = datagen.flow_from_directory(directory, target_size=(150, 150), batch_size=batch_size, class_mode='binary')
    i = 0
    for (inputs_batch, labels_batch) in generator:
        features_batch = conv_base.predict(inputs_batch)
        features[(i * batch_size):((i + 1) * batch_size)] = features_batch
        labels[(i * batch_size):((i + 1) * batch_size)] = labels_batch
        i += 1
        if ((i * batch_size) >= sample_count):
            break
    return (features, labels)