2

我已经安装了 sklearn、numpy 和 matplotlib,但是我无法正确安装 openBLAS,尽管我已经直接将 dopenBLAS 文件保存在 lib 文件夹(站点包)中,但它仍然显示错误......请帮助我执行这一小部分用于图像分类的 TensorFlow 卷积神经网络的代码。我从这里获取了这部分代码https://github.com/rdcolema/tensorflow-image-classification/blob/master/cnn.ipynb

import matplotlib.pyplot as plt
import tensorflow as tf
import pandas as pd
import numpy as np
from sklearn.metrics import confusion_matrix
import time
from datetime import timedelta
import math
import dataset
import random



# Convolutional Layer 1.
filter_size1 = 3 
num_filters1 = 32

# Convolutional Layer 2.
filter_size2 = 3
num_filters2 = 32

# Convolutional Layer 3.
filter_size3 = 3
num_filters3 = 64

# Fully-connected layer.
fc_size = 128             # Number of neurons in fully-connected layer.

# Number of color channels for the images: 1 channel for gray-scale.
num_channels = 3

# image dimensions (only squares for now)
img_size = 128

# Size of image when flattened to a single dimension
img_size_flat = img_size * img_size * num_channels

# Tuple with height and width of images used to reshape arrays.
img_shape = (img_size, img_size)

# class info
classes = ['dogs', 'cats']
num_classes = len(classes)

# batch size
batch_size = 16

# validation split
validation_size = .2

# how long to wait after validation loss stops improving before terminating 
training
early_stopping = None  # use None if you don't want to implement early 
stoping

train_path = 'C:/Projects/playground/kaggle/dogs_vs_cats/data/train/'
test_path = 'C:/Projects/playground/kaggle/dogs_vs_cats/data/test/test/'
checkpoint_dir = "C:/Projects/playground/tensorflow/tf_image_clf/models/"

data = dataset.read_train_sets(train_path, img_size, classes, 
validation_size=validation_size)
test_images, test_ids = dataset.read_test_set(test_path, img_size)
print("Size of:")
print("- Training-set:\t\t{}".format(len(data.train.labels)))
print("- Test-set:\t\t{}".format(len(test_images)))
print("- Validation-set:\t{}".format(len(data.valid.labels)))

Python IDE 上的输出:

Traceback (most recent call last):
  File "D:\Users\aysharma\birdclassifier.py", line 5, in <module>
    from sklearn.metrics import confusion_matrix
  File "D:\Users\aysharma\AppData\Local\Programs\Python\Python35\lib\site-
packages\sklearn\__init__.py", line 57, in <module>
    from .base import clone
  File "D:\Users\aysharma\AppData\Local\Programs\Python\Python35\lib\site-
packages\sklearn\base.py", line 10, in <module>
    from scipy import sparse
  File "D:\Users\aysharma\AppData\Local\Programs\Python\Python35\lib\site-
packages\scipy\__init__.py", line 122, in <module>
    raise ImportError("Numpy OpenBLAS flavour is needed for this scipy 
build.")
ImportError: Numpy OpenBLAS flavour is needed for this scipy build.
4

0 回答 0