我正在使用 Flutter 开发一个应用程序,并在物理 iOS 设备 (iPhone 7) 上测试该应用程序。
iOS版本是:15.3.1
Flutter版本是:2.10.3
当我测试我的应用程序时,偶尔会发生崩溃。崩溃给出以下错误。它并不总是在同一个地方崩溃,所以我不知道在这里分享什么代码。错误消息本身对我来说并没有说明太多,而且我在网上找不到有关此错误的任何有用信息。
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x443b8000443b8000)
frame #0: 0x0000000198405048 libobjc.A.dylib`objc_msgSend + 8
libobjc.A.dylib`objc_msgSend:
-> 0x198405048 <+8>: ldr x13, [x0]
0x19840504c <+12>: and x16, x13, #0xffffffff8
0x198405050 <+16>: mov x15, x16
0x198405054 <+20>: ldr x11, [x16, #0x10]
Target 0: (Runner) stopped.
Lost connection to device.
Exited (sigterm)
Run Code Online (Sandbox Code Playgroud)
接下来我可以检查什么?
我想知道我的 Stream Builder 是否做错了什么。这是我的代码的缩短版本:
class PrepareList extends StatefulWidget {
final String place;
const PrepareList({
Key? …Run Code Online (Sandbox Code Playgroud) dart firebase firebase-realtime-database flutter stream-builder
I use the Tensorflow v 1.14.0. I work on Windows 10. And here is how relevant environment variables look in the PATH:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\libnvvp
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Users\sinthes\AppData\Local\Programs\Python\Python37
C:\Users\sinthes\AppData\Local\Programs\Python\Python37\Scripts
C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\cuda\bin
Run Code Online (Sandbox Code Playgroud)
Maybe also worth to mention, just in case it might be relevant.. I use Sublime Text 3 for development and I do not use Anaconda. I find it a bit cumbersome to …
我按照此处的说明安装和测试 Firebase Crashlytics:
以下是其中一个步骤中需要完成的操作:
在 Xcode 中,从项目导航中选择 Runner。
选择“构建阶段”选项卡,然后单击“+”>“新建运行脚本阶段”。
将以下内容添加到 Shell 属性下方的“键入脚本...”文本框中:
我按照上面的说明将以下内容粘贴到 XCode 中:
$PODS_ROOT/FirebaseCrashlytics/upload-symbols --build-phase --validate -ai <googleAppId>
$PODS_ROOT/FirebaseCrashlytics/upload-symbols --build-phase -ai <googleAppId>
Run Code Online (Sandbox Code Playgroud)
哦!我<googleAppId>用从 Firebase 获得的真实 AppId 进行更改。
当我再次启动我的应用程序时,出现以下错误:
2021-12-23 19:16:50.044 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
2021-12-23 19:16:51.049 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
2021-12-23 19:16:52.054 upload-symbols[31089:256482] Unable to get file attributes for dSYM file at path "/Users/ednuser/Developer/FlutterProjects/MyProject/build/ios/Debug-iphoneos/Runner.app.dSYM/Contents/Resources/DWARF/Runner"
2021-12-23 19:16:53.060 upload-symbols[31089:256482] …Run Code Online (Sandbox Code Playgroud) ReduceLROnPlateauKeras中的回调似乎是用于训练模型的有趣工具。但是我无法真正弄清楚该cooldown参数ReduceLROnPlateau在Keras 的回调函数中究竟意味着什么。
文档说明如下:
一,功能接口:
keras.callbacks.ReduceLROnPlateau(monitor='val_loss',
factor=0.1,
patience=10,
verbose=0,
mode='auto',
min_delta=0.0001,
cooldown=0,
min_lr=0)
Run Code Online (Sandbox Code Playgroud)
ReduceLROnPlateau:一旦学习停滞,模型通常会受益于将学习率降低2-10倍。此回调监视数量,并且如果没有发现“耐心”时期的改善,则会降低学习率。
cooldown:减少lr之后恢复正常操作之前要等待的时期数。
这种解释对我来说并不十分清楚。是不是在说:-那样说lr=A。如果在时期patience数期间相关监视指标未改善,则学习率会降低。(并说lr=B减少之后)。然后,将学习率设置为历元数lr=A后的第一个值(再次)cooldown。
我的理解正确吗?如果不是,那么cooldown参数的真正功能是什么?
PS。当我用google搜索它时,我看到一些例子,人们将cooldown参数设置为零,这使我认为我对这个参数的看法是错误的。
Keras 有一个名为 flow_from_directory 的函数,其中一个参数称为 target_size。这是它的解释:
target_size: Tuple of integers (height, width), default: (256, 256).
The dimensions to which all images found will be resized.
Run Code Online (Sandbox Code Playgroud)
我不清楚的是它是否只是将原始图像裁剪成 256x256 矩阵(在这种情况下我们不拍摄整个图像)或者只是降低图像的分辨率(同时仍然向我们显示整个图像) ?
如果是 - 比方说 - 只需降低分辨率:假设我有一些尺寸为 1024x1024 的 X 射线图像(用于乳腺癌检测)。如果我想将迁移学习应用于仅接受 224x224 输入图像的预训练卷积神经网络,当我将图像的大小(和分辨率)从 1024x1024 减小到 224x224 时,我不会丢失重要的数据/信息吗?难道就没有这样的风险吗?
先感谢您!
artificial-intelligence machine-learning neural-network conv-neural-network keras
为了使模型的训练更快,在CPU上填充/生成批次并在GPU上并行运行模型的训练似乎是一个好习惯。为此,可以使用Python编写一个生成器类来继承Sequence该类。
这是文档的链接:https : //www.tensorflow.org/api_docs/python/tf/keras/utils/Sequence
该文档指出的重要内容是:
Sequence是进行多处理的更安全方法。这种结构保证了网络在每个时期的每个样本上只会训练一次,而生成器则不会。
它给出了一个简单的代码示例,如下所示:
from skimage.io import imread
from skimage.transform import resize
import numpy as np
import math
# Here, `x_set` is list of path to the images
# and `y_set` are the associated classes.
class CIFAR10Sequence(Sequence):
def __init__(self, x_set, y_set, batch_size):
self.x, self.y = x_set, y_set
self.batch_size = batch_size
def __len__(self):
return math.ceil(len(self.x) / self.batch_size)
def __getitem__(self, idx):
batch_x = self.x[idx * self.batch_size:(idx + 1) *
self.batch_size]
batch_y = self.y[idx * self.batch_size:(idx …Run Code Online (Sandbox Code Playgroud) 我正在尝试实现一个时间序列模型,但得到了一些奇怪的异常,但这些异常对我来说没有任何意义。我想知道我是否犯了一个错误,或者这是否完全是预料之中的。详细信息来了...
训练模型时,我尝试进行网格搜索以找到最佳(p、d、q)设置。这是完整的代码(我将在下面解释这里发生的事情):
下面的可重现代码本质上是来自https://machinelearningmastery.com/grid-search-arima-hyperparameters-with-python/的副本,有一些细微的变化......:
import warnings
from pandas import Series
from statsmodels.tsa.arima_model import ARIMA
from sklearn.metrics import mean_squared_error
# evaluate an ARIMA model for a given order (p,d,q)
def evaluate_arima_model(X, arima_order):
# prepare training dataset
train_size = int(len(X) * 0.66)
train, test = X[0:train_size], X[train_size:]
history = [x for x in train]
# make predictions
predictions = list()
for t in range(len(test)):
model = ARIMA(history, order=arima_order)
model_fit = model.fit(disp=0)
yhat = model_fit.forecast()[0]
predictions.append(yhat)
history.append(test[t])
# calculate out of …Run Code Online (Sandbox Code Playgroud) 我正在尝试实现一个连体网络(通过使用三元组损失方法)。我就是不能让它训练。经过多次尝试,我想我的问题出现在生成器中(我准备输入数据流用于训练),但到目前为止我无法定位问题。帮助!:)
这是我的模型定义(它基于 ResNet50)。
model = ResNet50(weights='imagenet')
model.layers.pop()
for layer in model.layers:
layer.trainable = False
x = model.get_layer('flatten_1').output
model_out = Dense(128, activation='sigmoid', name='model_out')(x)
new_model = Model(inputs=model.input, outputs=model_out)
Run Code Online (Sandbox Code Playgroud)
这里我定义了要训练的模型:
anchor_in = Input(shape=(224, 224, 3))
positive_in = Input(shape=(224, 224, 3))
negative_in = Input(shape=(224, 224, 3))
anchor_out = new_model(anchor_in)
positive_out = new_model(positive_in)
negative_out = new_model(negative_in)
merged_vector = concatenate([anchor_out, positive_out, negative_out], axis=-1)
# Define the model to be trained
siamese_model = Model(inputs=[anchor_in, positive_in, negative_in],
outputs=merged_vector)
siamese_model.compile(optimizer=Adam(lr=.001), loss=triplet_loss)
Run Code Online (Sandbox Code Playgroud)
能够训练模型。我需要使用生成器为它提供数据,这是我定义它的方式:
(请注意,我特意在每个文件夹中只放了 1 张图片只是为了开始。如果可以的话,我稍后会增加每个文件夹中的 # 个图片。)
def generator_three_imgs(): …Run Code Online (Sandbox Code Playgroud) machine-learning keras tensorflow convolutional-neural-network
我需要"有条件地"向现有的numpy数组添加2个新列,并希望在没有太多复杂性的情况下解决它.
假设我有以下数组:
a = np.array([[1, 2],
[-1, 4],
[1, 6],
[-1, 8]])
Run Code Online (Sandbox Code Playgroud)
对于这个数组,我需要添加2个新列,这将使数组看起来如下所示:
a = np.array([[1, 2, 2, 0 ],
[-1, 4, 2, 4 ],
[1, 6, 8, 4 ],
[-1, 8, 8, 12]])
Run Code Online (Sandbox Code Playgroud)
这是它背后的逻辑:
原始数组有2列.输出有4列.(3.和4.列是新的.)
3.列本质上是第二列的增量和,但只有在数组的第一列中相应的值为1时,才会继续添加第2列中的值(来自[:,1])(a: ,0]).例如:
创建4.列是相同的,但这次只需添加第二列(a [:,1])中的值,只要第一列的行值为-1即可.
是否有任何库函数以一种很好的方式支持这样的操作?
我需要开发一个 RNN 模型,并希望使用数据生成器来提供训练/评估循环。
首先,我在从 csv 文件中获取数据时使用了这个帮助功能。
RECORD_DEFAULTS_TRAIN = [[0], [0.0], [0.0], [0.0], [0.0], [0.0], [0.0]]
def decode_csv(line):
parsed_line = tf.decode_csv(line, RECORD_DEFAULTS_TRAIN)
label = parsed_line[-1] # label is the last element of the list
del parsed_line[-1] # delete the last element from the list
del parsed_line[0] # even delete the first element bcz it is assumed NOT to be a feature
features = tf.stack(parsed_line) # Stack features so that you can later vectorize forward prop., etc.
return features, label
Run Code Online (Sandbox Code Playgroud)
这是我的数据生成器功能:
def …Run Code Online (Sandbox Code Playgroud) keras ×6
python ×5
tensorflow ×5
firebase ×2
flutter ×2
generator ×2
arima ×1
callback ×1
convolutional-neural-network ×1
crashlytics ×1
dart ×1
ios ×1
numpy ×1
nvidia ×1
rnn ×1
statsmodels ×1
time-series ×1