Add notebook, gitignore

This commit is contained in:
Piv
2021-03-25 21:50:19 +10:30
parent 78d5aace15
commit 9449ddef01
2 changed files with 128 additions and 0 deletions

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
.idea
.keras
.config
.cache
__pycache__
.bash_history
.python_history
env

120
train.ipynb Normal file
View File

@@ -0,0 +1,120 @@
{
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8-final"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python3",
"display_name": "Python 3.8.8 64-bit",
"metadata": {
"interpreter": {
"hash": "ee99f7bd678359d45d92ad289bdab8f6bcfaae579cfd1bff07d2bb16d7ba024f"
}
}
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import fast_depth_functional as fd"
]
},
{
"source": [
"### Windows GPU Fix"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"1 Physical GPUs, 1 Logical GPUs\n"
]
}
],
"source": [
"fd.fix_windows_gpu()"
]
},
{
"source": [
"## Create and compile the model"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"WARNING:tensorflow:`input_shape` is undefined or non-square, or `rows` is not in [128, 160, 192, 224]. Weights for input shape (224, 224) will be loaded as the default.\n"
]
}
],
"source": [
"model = fd.mobilenet_nnconv5(weights='imagenet')\n",
"fd.compile(model)"
]
},
{
"source": [
"## Train the model using the nyu_v2 dataset (default, huge download)"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fd.train(existing_model=model, save_file='../fast-depth-experimental')"
]
},
{
"source": [
"## Evaluate the model"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fd.evaluate(model)"
]
}
]
}