小编AIN*_*LAH的帖子

ImportError:无法从“keras.preprocessing.image”导入名称“img_to_array”

我是新来的。我对这段代码有问题,

#Library
import numpy as np
import pickle
import cv2
from os import listdir
from sklearn.preprocessing import LabelBinarizer
from keras.models import Sequential
from keras.layers import BatchNormalization
from keras.layers.convolutional import Conv2D
from keras.layers.convolutional import MaxPooling2D
from keras.layers.core import Activation, Flatten, Dropout, Dense
from keras import backend as K
from keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import Adam
from keras.preprocessing import image
#from tensorflow.keras.preprocessing.image import img_to_array
from keras.preprocessing.image import img_to_array
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
Run Code Online (Sandbox Code Playgroud)

我收到一个错误 …

python keras

10
推荐指数
1
解决办法
7万
查看次数

错误:无法为 pycocotools 构建轮子,这是安装基于 pyproject.toml 的项目所必需的

我在使用对象检测 API 安装 TensorFlow 时遇到问题。\n我按照此 URL 中的步骤操作: https: //github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2.md

\n

步骤:

\n
git clone https://github.com/tensorflow/models.git\n\ncd models/research\nprotoc object_detection/protos/*.proto --python_out=.\ncp object_detection/packages/tf2/setup.py .\npython -m pip install \n
Run Code Online (Sandbox Code Playgroud)\n

我得到的错误是 pycocotools builds erro

\n
Building wheel for pycocotools (pyproject.toml) ... error\n  error: subprocess-exited-with-error\n\n  \xc3\x97 Building wheel for pycocotools (pyproject.toml) did not run successfully.\n  \xe2\x94\x82 exit code: 1\n  \xe2\x95\xb0\xe2\x94\x80> [14 lines of output]\n      running bdist_wheel\n      running build\n      running build_py\n      creating build\n      creating build\\lib.win-amd64-cpython-38\n      creating build\\lib.win-amd64-cpython-38\\pycocotools\n      copying pycocotools\\coco.py -> build\\lib.win-amd64-cpython-38\\pycocotools\n      copying pycocotools\\cocoeval.py -> build\\lib.win-amd64-cpython-38\\pycocotools\n      copying pycocotools\\mask.py …
Run Code Online (Sandbox Code Playgroud)

python python-3.x object-detection-api tensorflow2.0 pycocotools

10
推荐指数
2
解决办法
6万
查看次数