小编des*_*ger的帖子

np.mean 的 Numba 失败

出于某种原因,当我向 np.mean 添加轴参数时,numba 失败。例如,这给出了一个错误 -

import numpy as np
from numba import jit
@jit(nopython=True)
def num_prac(a):
    return np.mean(a,-1)

b=np.array([[1,2,3,4,5],[1,2,3,4,5]])
print(num_prac(b))

TypingError: Invalid use of Function(<function mean at 0x000002949B28E1E0>) with argument(s) of type(s): (array(int32, 2d, C), Literal[int](1))
 * parameterized
In definition 0:
    AssertionError: 
    raised from C:\ProgramData\Anaconda3\lib\site-packages\numba\typing\arraydecl.py:649
In definition 1:
    AssertionError: 
    raised from C:\ProgramData\Anaconda3\lib\site-packages\numba\typing\arraydecl.py:649
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<function mean at 0x000002949B28E1E0>) …
Run Code Online (Sandbox Code Playgroud)

python numpy python-3.x numba

5
推荐指数
1
解决办法
1730
查看次数

在 Python 中比 MSE 更好地比较图像的快速技术

我一直在使用结构相似性指数(通过 tensorflow)来比较图像,但是它花费的时间太长。我想知道是否有一种不需要太多时间的替代技术。如果有人能指出比 Python 中的 tensorflow 更有效的 SSIM 实现,那也没关系。

我使用 SSIM 的意图是,给定一个参考图像 (A) 和一图像 (B),我需要了解 B 中的哪个图像与参考图像 A 最相似。

image-processing similarity python-3.x ssim

5
推荐指数
1
解决办法
457
查看次数

如何解释 Keras GRU 的 get_weights ?

我无法解释 GRU 层 get_weights 的结果。这是我的代码 -

#Modified from - https://machinelearningmastery.com/understanding-simple-recurrent-neural-networks-in-keras/
from pandas import read_csv
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, SimpleRNN, GRU
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error
import math
import matplotlib.pyplot as plt

model = Sequential()
model.add(GRU(units = 2, input_shape = (3,1), activation = 'linear'))
model.add(Dense(units = 1, activation = 'linear'))
model.compile(loss = 'mean_squared_error', optimizer = 'adam')

initial_weights = model.layers[0].get_weights()
print("Shape = ",initial_weights)
Run Code Online (Sandbox Code Playgroud)

我熟悉 GRU 概念。此外,我了解 get_weights 如何用于 Keras Simple RNN …

keras tensorflow keras-layer tensorflow2.0 gru

2
推荐指数
1
解决办法
901
查看次数

找不到“生成 Visual Studio 项目文件”的选项

我使用Unreal 4.25开发了一个环境。为了将其与 Airsim 连接,我按照此处给出的说明进行操作 - https://microsoft.github.io/AirSim/unreal_custenv/

我被困在他们说右键单击 .uproject 文件并选择“生成 Visual Studio 项目文件”的地方,因为我没有该选项。

在此输入图像描述

unreal-engine4

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