Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #108

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.DS_Store
tools
*_old

.fake
Copilot/
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"python.languageServer": "Pylance",
"python.analysis.typeCheckingMode": "basic",
"typescript.tsserver.maxTsServerMemory": 3072,
"typescript.tsserver.watchOptions": {
"watchFile": "dynamicPriorityPolling"
},
"javascript.suggest.includeAutomaticOptionalChainCompletions": false,
"debug.saveBeforeStart": "none",
"vscode-as-git-mergetool.settingsAssistantOnStartup": false,
"c3.welcome.showFeatureHighlight": false,
"git-blame.gitWebUrl": "",
"workbench.view.alwaysShowHeaderActions": true
}
104 changes: 86 additions & 18 deletions p1ch2/2_pre_trained_networks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"from torchvision import models"
Expand All @@ -12,7 +16,11 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -72,7 +80,11 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"alexnet = models.AlexNet()"
Expand All @@ -81,7 +93,11 @@
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"resnet = models.resnet101(pretrained=True)"
Expand All @@ -90,7 +106,11 @@
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -438,7 +458,11 @@
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"from torchvision import transforms\n",
Expand All @@ -455,7 +479,11 @@
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"from PIL import Image\n",
Expand All @@ -465,7 +493,11 @@
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand All @@ -486,7 +518,11 @@
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"img_t = preprocess(img)"
Expand All @@ -495,7 +531,11 @@
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"import torch\n",
Expand All @@ -505,7 +545,11 @@
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -853,7 +897,11 @@
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -1074,7 +1122,11 @@
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"with open('../data/p1ch2/imagenet_classes.txt') as f:\n",
Expand All @@ -1084,7 +1136,11 @@
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"_, index = torch.max(out, 1)"
Expand All @@ -1093,7 +1149,11 @@
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand All @@ -1114,7 +1174,11 @@
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
{
"data": {
Expand All @@ -1139,7 +1203,11 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": []
}
Expand All @@ -1165,4 +1233,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#
# And then the virtual environment can be created by running:
#
# python3 -m venv .venv
# .venv/bin/pip install --upgrade pip
# .venv/bin/pip install -r requirements.txt
python3 -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -r requirements.txt
#
# Then use .venv/bin/python to run the various training scripts.

Expand Down