我正在为图像分类问题训练 2 个不同的 CNN(自定义学习和迁移学习)。我对两种型号使用相同的发电机。该数据集包含 5 个类别的 5000 个样本,但不平衡。
这是我正在使用的自定义模型。
def __init__(self, transfer_learning = False, lambda_reg = 0.001, drop_out_rate = 0.1):
if(transfer_learning == False):
self.model = Sequential();
self.model.add(Conv2D(32, (3,3), input_shape = (224,224,3), activation = "relu"))
self.model.add(MaxPooling2D(pool_size = (2,2)))
self.model.add(Conv2D(64, (1,1), activation = "relu"))
self.model.add(MaxPooling2D(pool_size = (2,2)))
self.model.add(Conv2D(128, (3,3), activation = "relu"))
self.model.add(MaxPooling2D(pool_size = (2,2)))
self.model.add(Conv2D(128, (1,1), activation = "relu"))
self.model.add(MaxPooling2D(pool_size = (2,2)))
self.model.add(Flatten())
self.model.add(Dense(512))
self.model.add(Dropout(drop_out_rate))
self.model.add(Dense(256))
self.model.add(Dropout(drop_out_rate))
self.model.add(Dense(5, activation = "softmax"))
Run Code Online (Sandbox Code Playgroud)
steps_per_epoch所以我无法理解和之间的关系batch_size。
batch_size是生成器发送的样本数。但完成一个训练 epochsteps_per_epoch的数量是多少呢?batch_size …
python machine-learning conv-neural-network keras tensorflow
我正在尝试用 Plotly 制作 2*7 的子图。
\n我想使用 foor 循环迭代我的数据,为子图中的每个位置制作不同的饼图。\n我面临 2 个问题,我不知道如何在迭代时给出位置。\n而且我也不'即使我调用“show”方法,我的身材上也没有任何东西。
\nimport plotly.graph_objs as go\nfrom plotly.subplots import make_subplots\nlabels = stock_by_portals_private.index\n\nspec=[[{'type':'domain'}, {'type':'domain'}, {'type':'domain'}, {'type':'domain'}, {'type':'domain'}, \n{'type':'domain'}, {'type':'domain'}],\n [{'type':'domain'}, {'type':'domain'}, {'type':'domain'}, {'type':'domain'}, {'type':'domain'}, \n{'type':'domain'}, {'type':'domain'}]]\n\nfig = make_subplots(rows=2, cols=7, specs=spec, print_grid=True)\ni = 1\nj = 1\nfor label in labels:\n private = stock_by_portals_private[stock_by_portals_private.index == label]['id']\n pro = stock_by_portals_pro[stock_by_portals_pro.index == label]['id']\n fig.add_trace(go.Pie(labels=['PRO', 'PRIVATE'], values=[pro , private ],\\\n name="R\xc3\xa9partition des annonceurs par portail: " + str(label)), 1,1)\n\nfig.update_traces(hoverinfo='label+percent+name', textinfo='none')\nfig = go.Figure(fig)\nfig.show()\nRun Code Online (Sandbox Code Playgroud)\n