refactoring

This commit is contained in:
frankknoll
2023-03-16 15:50:38 +01:00
parent ab3d5a87bf
commit c6d8b04298

View File

@@ -90,15 +90,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"if inColab:\n",
" sys.path.insert(0, srcPath)"
],
"metadata": { "metadata": {
"id": "c-2fE6vZsD7a" "id": "c-2fE6vZsD7a"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"if inColab:\n",
" sys.path.insert(0, srcPath)"
]
}, },
{ {
"cell_type": "code", "cell_type": "code",
@@ -274,21 +274,6 @@
" return accuracy.result().numpy()" " return accuracy.result().numpy()"
] ]
}, },
{
"cell_type": "code",
"source": [
"def saveModel(srcPath, modelDAO, model):\n",
" modelFilepath = f'{srcPath}/captcha/{model.name}'\n",
" modelDAO.saveModel(model, modelFilepath)\n",
" if inColab:\n",
" GoogleDriveManager.uploadFolderToGoogleDrive(modelFilepath, model.name)"
],
"metadata": {
"id": "WG2rSl9nxZQ0"
},
"execution_count": null,
"outputs": []
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@@ -325,6 +310,19 @@
"datasetFactory = DatasetFactory(captchaShape, charNumConverter.char_to_num, batch_size = 64)" "datasetFactory = DatasetFactory(captchaShape, charNumConverter.char_to_num, batch_size = 64)"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def saveModel(model):\n",
" modelFilepath = f'{srcPath}/captcha/{model.name}'\n",
" modelDAO.saveModel(model, modelFilepath)\n",
" if inColab:\n",
" GoogleDriveManager.uploadFolderToGoogleDrive(modelFilepath, model.name)"
]
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": { "metadata": {
@@ -436,7 +434,7 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"saveModel(srcPath, modelDAO, model)" "saveModel(model)"
] ]
}, },
{ {
@@ -625,14 +623,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": [ "execution_count": null,
"saveModel(srcPath, modelDAO, model)"
],
"metadata": { "metadata": {
"id": "FpJTHU6dxOVy" "id": "FpJTHU6dxOVy"
}, },
"execution_count": null, "outputs": [],
"outputs": [] "source": [
"saveModel(model)"
]
} }
], ],
"metadata": { "metadata": {
@@ -662,4 +660,4 @@
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 0 "nbformat_minor": 0
} }