內容來自其它作者,原文鏈接:https://blog.csdn.net/weixin_45209827/article/details/115963340
一.數據集
在訓練時報錯TypeError: Argument ‘bb’ has incorrect type (expected numpy.ndarray, got list)
在這里插入圖片描述
網上有些人說是coco包版本太低的問題,或者數據點數應該為偶數等,我查看了自己pycocotools的版本已經為2.0.0,並不是版本問題。然后查看了json文件,發現我用的代碼只能訓練用多邊形標記的,其他類型的標記都會報這個錯誤。之后重新標記了數據集,成功解決。
另:
ERR0:root:Frar pnrocessing inage {'anotations ': [ ‘box’: […]的問題有可能也是數據集的問題,也有可能是類別設置的不對,需進行修改。
二 Error12無法分配內存
訓練時遇到了這個錯誤,應該是內存到極限了,但並未影響服務器的運行
看下內存的使用情況,可參考:Error12
三.RuntimeError: It looks like you are subclassing Model and you forgot to call super(YourClass, self).__init__().
用多個GPU訓練遇到樣的錯誤。
在parallel_model.py中的類ParallelModel加入代碼:super(YourClass, self).init()
def __init__(self, keras_model, gpu_count): """ Class constructor. :param keras_model: The Keras model to parallelize :param gpu_count: gpu 個數,當 gpu 個數 大於 1 時,調用這個對象,啟用多 GPU 訓練 """ super(YourClass, self).__init__()#加入的代碼 self.inner_model = keras_model self.gpu_count = gpu_count merged_outputs = self.make_parallel() super(ParallelModel, self).__init__(inputs=self.inner_model.inputs, outputs=merged_outputs)
四.卡在epoch1不動
把workers改成1,或者看看圖片是否太大
self.mask_model.keras_model.fit_generator(generator=train_generator, initial_epoch=self.epoch, epochs=epochs, steps_per_epoch=cfg.TRAIN.STEPS_PER_EPOCH, callbacks=callbacks, validation_data=val_generator, validation_steps=cfg.TRAIN.VALIDATION_STEPS, max_queue_size=100, workers=workers, use_multiprocessing=True, )
五.程序掛起
訓練時卡在一個epoch不動,程序不報錯,在運行,但就是不繼續訓練下去了,如果改workers沒用的話,查看GPU的利用率
發現GPU沒有繼續工作下去了,將kares換為2.1.6版本,就解決了程序掛起問題
六. FutureWarning: Input image dtype is bool
錯誤信息:
E:\Anaconda3\install\envs\wind_202104\lib\site-packages\skimage\transform\_warps.py:830: FutureWarning: Input image dtype is bool. Interpolation is not defined with bool data type. Please set order to 0 or explicitely cast input image to another data type. Starting from version 0.19 a ValueError will be raised instead of this warning. order = _validate_interpolation_order(image.dtype, order)
方法:
調整scikit-image==0.16.2
七. 注意其它庫的版本,如numpy,過高或過低都會出現錯誤