Skip to content

Commit c7895df

Browse files
authored
fix deprecated ANTIALIAS method (#350)
1 parent 1992a1d commit c7895df

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

nvidia_deeplearningexamples_resnet50.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ order: 10
1717
demo-model-link: https://huggingface.co/spaces/pytorch/ResNet50
1818
---
1919

20-
2120
### Model Description
2221

23-
The ***ResNet50 v1.5*** model is a modified version of the [original ResNet50 v1 model](https://arxiv.org/abs/1512.03385).
22+
The **_ResNet50 v1.5_** model is a modified version of the [original ResNet50 v1 model](https://arxiv.org/abs/1512.03385).
2423

2524
The difference between v1 and v1.5 is that, in the bottleneck blocks which requires
2625
downsampling, v1 has stride = 2 in the first 1x1 convolution, whereas v1.5 has stride = 2 in the 3x3 convolution.
@@ -33,12 +32,12 @@ This model is trained with mixed precision using Tensor Cores on Volta, Turing,
3332

3433
Note that the ResNet50 v1.5 model can be deployed for inference on the [NVIDIA Triton Inference Server](https://github.com/triton-inference-server/server) using TorchScript, ONNX Runtime or TensorRT as an execution backend. For details check [NGC](https://ngc.nvidia.com/catalog/resources/nvidia:resnet_for_triton_from_pytorch)
3534

36-
3735
### Example
3836

39-
In the example below we will use the pretrained ***ResNet50 v1.5*** model to perform inference on ***image*** and present the result.
37+
In the example below we will use the pretrained **_ResNet50 v1.5_** model to perform inference on **_image_** and present the result.
4038

4139
To run the example you need some extra python packages installed. These are needed for preprocessing images and visualization.
40+
4241
```python
4342
!pip install validators matplotlib
4443
```
@@ -60,6 +59,7 @@ print(f'Using {device} for inference')
6059
```
6160

6261
Load the model pretrained on ImageNet dataset.
62+
6363
```python
6464
resnet50 = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_resnet50', pretrained=True)
6565
utils = torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_convnets_processing_utils')
@@ -68,6 +68,7 @@ resnet50.eval().to(device)
6868
```
6969

7070
Prepare sample input data.
71+
7172
```python
7273
uris = [
7374
'http://images.cocodataset.org/test-stuff2017/000000024309.jpg',
@@ -82,34 +83,36 @@ batch = torch.cat(
8283
```
8384

8485
Run inference. Use `pick_n_best(predictions=output, n=topN)` helper function to pick N most probably hypothesis according to the model.
86+
8587
```python
8688
with torch.no_grad():
8789
output = torch.nn.functional.softmax(resnet50(batch), dim=1)
88-
90+
8991
results = utils.pick_n_best(predictions=output, n=5)
9092
```
9193

9294
Display the result.
95+
9396
```python
9497
for uri, result in zip(uris, results):
9598
img = Image.open(requests.get(uri, stream=True).raw)
96-
img.thumbnail((256,256), Image.ANTIALIAS)
99+
img.thumbnail((256,256), Image.LANCZOS)
97100
plt.imshow(img)
98101
plt.show()
99102
print(result)
100103

101104
```
102105

103106
### Details
107+
104108
For detailed information on model input and output, training recipies, inference and performance visit:
105109
[github](https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Classification/ConvNets/resnet50v1.5)
106110
and/or [NGC](https://ngc.nvidia.com/catalog/resources/nvidia:resnet_50_v1_5_for_pytorch)
107111

108112
### References
109113

110-
- [Original ResNet50 v1 paper](https://arxiv.org/abs/1512.03385)
111-
- [Delving deep into rectifiers: Surpassing human-level performance on ImageNet classification](https://arxiv.org/pdf/1502.01852.pdf)
112-
- [model on github](https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Classification/ConvNets/resnet50v1.5)
113-
- [model on NGC](https://ngc.nvidia.com/catalog/resources/nvidia:resnet_50_v1_5_for_pytorch)
114-
- [pretrained model on NGC](https://ngc.nvidia.com/catalog/models/nvidia:resnet50_pyt_amp)
115-
114+
- [Original ResNet50 v1 paper](https://arxiv.org/abs/1512.03385)
115+
- [Delving deep into rectifiers: Surpassing human-level performance on ImageNet classification](https://arxiv.org/pdf/1502.01852.pdf)
116+
- [model on github](https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Classification/ConvNets/resnet50v1.5)
117+
- [model on NGC](https://ngc.nvidia.com/catalog/resources/nvidia:resnet_50_v1_5_for_pytorch)
118+
- [pretrained model on NGC](https://ngc.nvidia.com/catalog/models/nvidia:resnet50_pyt_amp)

0 commit comments

Comments
 (0)