"ConvNeXt"系列型号是否已从 Keras 中删除?



当尝试使用来自Keras的ConvNeXtTiny模型时,我得到以下错误:AttributeError: module ' Keras。applications'没有属性'ConvNeXtTiny'

filename = "ConvNextTiny_firstpass_model"
# layer construction
base_model = applications.ConvNeXtTiny( #preproccing included
input_shape=(targetWidth, targetHeight, 3),
include_top=False,
)
base_model.trainable = False
flatten_layer = layers.Flatten()
fc_layer = layers.Dense(1024, activation='relu')
dropout_layer = layers.Dropout(0.3) 
#layer connecting
x = flip_layer(input_layer)
x = base_model(x, training=False)
x = flatten_layer(x)
x = fc_layer(x)
x = dropout_layer(x)
predictions = output_layer(x)
model = keras.Model(input_layer, predictions)

这是我的进口:

import tensorflow as tf
import keras 
from keras import layers
from keras import optimizers
from keras import applications
from keras import losses
from keras import callbacks
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import cv2 as cv
import csv
from sklearn.utils import shuffle

可能的相关版本:

ipython==8.5.0
tensorflow==2.10.0
keras==2.10.0
Keras-Preprocessing==1.1.2
pandas==1.4.4
numpy==1.23.3
matplotlib==3.6.0
opencv-python==4.6.0.66
sklearn==0.0

先前置于convnext导入之上的导入会导致问题。

from tensorflow.keras.applications import convnext移到所有导入的顶部,使其能够正确导入。

相关内容

  • 没有找到相关文章

最新更新