我知道我可以pip install opencv-python安装opencv3,但是对于opencv特定版本(例如2.4.9)是否有单独的命令或名称?
如果没有,我如何指定要安装的版本?
谢谢.
我知道在安装tensorflow时,您要么安装GPU版本,要么安装CPU版本.如何检查安装了哪一个(我使用的是linux).
如果安装了GPU版本,如果GPU不可用,它会自动在CPU上运行还是会抛出错误?如果GPU可用,是否需要设置特定字段或值以确保它在GPU上运行?
我正在从 Angular 8.2 升级到 9.1,并且我正在尝试将私有字段更改为TS 3.8#fieldName: any所允许的而不是. 我得到编译器错误说private fieldName: any
私有标识符仅在针对 ECMAScript 2015 及更高版本时可用。
tsconfig.json:
{
"compilerOptions": {
"module": "esnext"
"target": "es2015",
}
}
Run Code Online (Sandbox Code Playgroud)
包.json:
"devDependencies": {
"typescript": "3.8.3"
}
Run Code Online (Sandbox Code Playgroud) 两个http调用完成后,我使用Observable.forkJoin()来处理响应,但如果其中任何一个返回错误,我怎么能捕获该错误?
Observable.forkJoin(
this.http.post<any[]>(URL, jsonBody1, postJson) .map((res) => res),
this.http.post<any[]>(URL, jsonBody2, postJson) .map((res) => res)
)
.subscribe(res => this.handleResponse(res))
Run Code Online (Sandbox Code Playgroud) 我有一个存储numpy数组的h5py文件,但是Object doesn't exist error当我尝试使用我记得的数据集名称打开它时,我有一种方法可以列出文件的数据集吗?
with h5py.File('result.h5','r') as hf:
#How can I list all dataset I have saved in hf?
Run Code Online (Sandbox Code Playgroud) 我正在尝试显示卷积神经网络每一层的输出。我使用的后端是 TensorFlow。这是代码:
import ....
from keras import backend as K
model = Sequential()
model.add(Convolution2D(32, 3, 3, input_shape = (1,28,28)))
convout1 = Activation('relu')
model.add(convout1)
(X_train, y_train), (X_test, y_test) = mnist_dataset = mnist.load_data("mnist.pkl")
reshaped = X_train.reshape(X_train.shape[0], 1, X_train.shape[1], X_train.shape[2])
from random import randint
img_to_visualize = randint(0, len(X_train) - 1)
# Generate function to visualize first layer
# ERROR HERE
convout1_f = K.function([model.input(train=False)], convout1.get_output(train=False)) #ERROR HERE
convolutions = convout1_f(reshaped[img_to_visualize: img_to_visualize+1])
Run Code Online (Sandbox Code Playgroud)
完整的错误是:
convout1_f = K.function([model.input(train=False)], convout1.get_output(train=False)) TypeError: 'Tensor' 对象不可调用
任何评论或建议都非常感谢。谢谢你。
machine-learning neural-network conv-neural-network keras tensorflow
我正在使用keras的预训练模型VGG16,遵循以下链接:Keras VGG16 我正在尝试将预测输出解码为图像中的内容:
model = VGG16(weights='imagenet', include_top=False)
img_path = 'elephant.jpg'
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
features = model.predict(x)
(inID, label) = decode_predictions(features)[0] #ERROR HERE
Run Code Online (Sandbox Code Playgroud)
完整的错误是:
ValueError:
decode_predictions期望一批预测(即2D形状阵列(样本,1000)).找到形状为:(1,7,7,512)的数组
任何意见或建议都非常感谢.谢谢.
我在loss.py文件中的keras中定义了一个新的损失函数.我关闭并重新启动anaconda提示,但我得到了ValueError: ('Unknown loss function', ':binary_crossentropy_2').我在Windows 10上使用python2.7和anaconda运行keras.
我通过在编译我的模型的python文件中添加loss函数来暂时解决它.
我按照此链接中的示例进行操作。然而,轮廓从初始点开始收缩。是否可以做展开的轮廓?我想要像显示的图像那样的东西。左边的图像是它的样子,右边的图像是我想要的样子——向外扩展而不是收缩。红色圆圈为起点,蓝色轮廓为n次迭代后。有没有我可以设置的参数 - 我查看了所有参数,但似乎没有设置参数。另外,当提到“活动轮廓”时,它通常是否假设轮廓收缩?我读了这篇论文,认为它既可以收缩也可以扩展。
img = data.astronaut()
img = rgb2gray(img)
s = np.linspace(0, 2*np.pi, 400)
x = 220 + 100*np.cos(s)
y = 100 + 100*np.sin(s)
init = np.array([x, y]).T
if not new_scipy:
print('You are using an old version of scipy. '
'Active contours is implemented for scipy versions '
'0.14.0 and above.')
if new_scipy:
snake = active_contour(gaussian(img, 3),
init, alpha=0.015, beta=10, gamma=0.001)
fig = plt.figure(figsize=(7, 7))
ax = fig.add_subplot(111)
plt.gray()
ax.imshow(img)
ax.plot(init[:, 0], init[:, 1], '--r', lw=3) …Run Code Online (Sandbox Code Playgroud) 到目前为止,我有一些不应运行的单元测试,是否可以跳过它们?除了在要运行的程序上使用fdescribe之外。
keras ×4
angular ×3
tensorflow ×2
angular-http ×1
angular6 ×1
angular9 ×1
h5py ×1
numpy ×1
opencv ×1
package ×1
pip ×1
promise ×1
python ×1
rxjs ×1
scikit-image ×1
typescript ×1