Skip to content

Commit 10d31f6

Browse files
committed
Port torchvision tutorial to gallery and remove previous files
1 parent 3e9e8f6 commit 10d31f6

File tree

10 files changed

+34
-658
lines changed

10 files changed

+34
-658
lines changed

.jenkins/validate_tutorials_built.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"beginner_source/former_torchies/tensor_tutorial_old",
2323
"beginner_source/examples_autograd/polynomial_autograd",
2424
"beginner_source/examples_autograd/polynomial_custom_function",
25-
"beginner_source/t5_tutorial", # re-enable after this is fixed: https://github.com/pytorch/text/issues/1756
25+
"beginner_source/t5_tutorial", # re-enable after this is fixed: https://github.com/pytorch/text/issues/1756
2626
"intermediate_source/parametrizations",
2727
"intermediate_source/mnist_train_nas", # used by ax_multiobjective_nas_tutorial.py
2828
"intermediate_source/fx_conv_bn_fuser",

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ download:
8686
wget -nv -N https://www.manythings.org/anki/deu-eng.zip -P $(DATADIR)
8787
unzip -o $(DATADIR)/deu-eng.zip -d beginner_source/data/
8888

89+
# Download PennFudanPed dataset for intermediate_source/torchvision_tutorial.py
90+
wget https://www.cis.upenn.edu/~jshi/ped_html/PennFudanPed.zip -P $(DATADIR)
91+
unzip -o $(DATADIR)/PennFudanPed.zip -d intermediate_source/data/
8992

9093
docs:
9194
make download
@@ -103,3 +106,5 @@ html-noplot:
103106
clean-cache:
104107
make clean
105108
rm -rf advanced beginner intermediate recipes
109+
# remove additional python files downloaded for torchvision_tutorial.py
110+
rm -rf intermediate_source/engine.py intermediate_source/utils.py intermediate_source/transforms.py intermediate_source/coco_eval.py intermediate_source/coco_utils.py
-612 KB
Binary file not shown.
-12.4 KB
Binary file not shown.
-418 KB
Binary file not shown.
-849 KB
Binary file not shown.

en-wordlist.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RRef
1010
OOM
1111
subfolder
1212
Dialogs
13+
PennFudan
1314
performant
1415
multithreading
1516
linearities
@@ -30,6 +31,8 @@ breakpoint
3031
MobileNet
3132
DeepLabV
3233
Resampling
34+
RCNN
35+
RPN
3336
APIs
3437
ATen
3538
AVX
@@ -134,6 +137,7 @@ LRSchedulers
134137
Lua
135138
Luong
136139
macos
140+
mAP
137141
MLP
138142
MLPs
139143
MNIST
@@ -165,10 +169,12 @@ OU
165169
PIL
166170
PPO
167171
Plotly
172+
pre
168173
Prec
169174
Profiler
170175
PyTorch's
171176
RGB
177+
RGBA
172178
RL
173179
RNN
174180
RNNs
@@ -331,6 +337,7 @@ jit
331337
jitter
332338
jpg
333339
judgements
340+
keypoint
334341
kwargs
335342
labelled
336343
learnable
@@ -411,6 +418,7 @@ reinitializes
411418
relu
412419
reproducibility
413420
rescale
421+
rescaling
414422
resnet
415423
restride
416424
rewinded
@@ -462,10 +470,12 @@ torchscriptable
462470
torchtext
463471
torchtext's
464472
torchvision
473+
TorchVision
465474
torchviz
466475
traceback
467476
tradeoff
468477
tradeoffs
478+
uint
469479
uncomment
470480
uncommented
471481
underflowing

_static/tv-training-code.py renamed to intermediate_source/torchvision_tutorial.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,10 @@
66

77
######################################################################
88
#
9-
# .. tip::
10-
#
11-
# To get the most of this tutorial, we suggest using this
12-
# `Colab Version <https://colab.research.google.com/github/pytorch/tutorials/blob/gh-pages/_downloads/torchvision_finetuning_instance_segmentation.ipynb>`__.
13-
# This will allow you to experiment with the information presented below.
14-
#
15-
#
169
# For this tutorial, we will be finetuning a pre-trained `Mask
17-
# R-CNN <https://arxiv.org/abs/1703.06870>`__ model on the `Penn-Fudan
10+
# R-CNN <https://arxiv.org/abs/1703.06870>`_ model on the `Penn-Fudan
1811
# Database for Pedestrian Detection and
19-
# Segmentation <https://www.cis.upenn.edu/~jshi/ped_html/>`__. It contains
12+
# Segmentation <https://www.cis.upenn.edu/~jshi/ped_html/>`_. It contains
2013
# 170 images with 345 instances of pedestrians, and we will use it to
2114
# illustrate how to use the new features in torchvision in order to train
2215
# an object detection and instance segmentation model on a custom dataset.
@@ -65,7 +58,7 @@
6558
# ``pycocotools`` which can be installed with ``pip install pycocotools``.
6659
#
6760
# .. note ::
68-
# For Windows, please install ``pycocotools`` from `gautamchitnis <https://github.com/gautamchitnis/cocoapi>`__ with command
61+
# For Windows, please install ``pycocotools`` from `gautamchitnis <https://github.com/gautamchitnis/cocoapi>`_ with command
6962
#
7063
# ``pip install git+https://github.com/gautamchitnis/cocoapi.git@cocodataset-master#subdirectory=PythonAPI``
7164
#
@@ -85,10 +78,16 @@
8578
# Writing a custom dataset for PennFudan
8679
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8780
#
88-
# Let’s write a dataset for the PennFudan dataset. After `downloading and
89-
# extracting the zip
90-
# file <https://www.cis.upenn.edu/~jshi/ped_html/PennFudanPed.zip>`__, we
91-
# have the following folder structure:
81+
# Let’s write a dataset for the PennFudan dataset. First, let's download the dataset and
82+
# extract the `zip file <https://www.cis.upenn.edu/~jshi/ped_html/PennFudanPed.zip>`_:
83+
#
84+
# .. code:: python
85+
#
86+
# wget https://www.cis.upenn.edu/~jshi/ped_html/PennFudanPed.zip -P data
87+
# cd data && unzip PennFudanPed.zip
88+
#
89+
#
90+
# We have the following folder structure:
9291
#
9392
# ::
9493
#
@@ -196,8 +195,8 @@ def __len__(self):
196195
# -------------------
197196
#
198197
# In this tutorial, we will be using `Mask
199-
# R-CNN <https://arxiv.org/abs/1703.06870>`__, which is based on top of
200-
# `Faster R-CNN <https://arxiv.org/abs/1506.01497>`__. Faster R-CNN is a
198+
# R-CNN <https://arxiv.org/abs/1703.06870>`_, which is based on top of
199+
# `Faster R-CNN <https://arxiv.org/abs/1506.01497>`_. Faster R-CNN is a
201200
# model that predicts both bounding boxes and class scores for potential
202201
# objects in the image.
203202
#
@@ -484,7 +483,7 @@ def get_transform(train):
484483
from torchvision.utils import draw_bounding_boxes, draw_segmentation_masks
485484

486485

487-
image = read_image("../_static/img/tv_tutorial/tv_image05.png")
486+
image = read_image("data/PennFudanPed/PNGImages/FudanPed00046.png")
488487
eval_transform = get_transform(train=False)
489488

490489
model.eval()
@@ -527,4 +526,4 @@ def get_transform(train):
527526
# the torchvision repository.
528527
#
529528
# You can download a full source file for this tutorial
530-
# `here <https://pytorch.org/tutorials/_static/tv-training-code.py>`__.
529+
# `here <https://pytorch.org/tutorials/_static/tv-training-code.py>`_.

0 commit comments

Comments
 (0)