From 5a8258d313f8ec5bd334202d5325212d72822c3f Mon Sep 17 00:00:00 2001 From: Junyong Kang <46196781+FollowerOfScriabin@users.noreply.github.com> Date: Sun, 24 Jul 2022 16:43:14 +0900 Subject: [PATCH 1/5] Update pytorch_vision_resnext.md --- pytorch_vision_resnext.md | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/pytorch_vision_resnext.md b/pytorch_vision_resnext.md index 055c1ab..9f95637 100644 --- a/pytorch_vision_resnext.md +++ b/pytorch_vision_resnext.md @@ -1,11 +1,4 @@ ---- -layout: hub_detail -background-class: hub-background -body-class: hub -title: ResNext -summary: Next generation ResNets, more efficient and accurate -category: researchers -image: resnext.png + author: Pytorch Team tags: [vision, scriptable] github-link: https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py @@ -25,15 +18,12 @@ model = torch.hub.load('pytorch/vision:v0.10.0', 'resnext50_32x4d', pretrained=T model.eval() ``` -All pre-trained models expect input images normalized in the same way, -i.e. mini-batches of 3-channel RGB images of shape `(3 x H x W)`, where `H` and `W` are expected to be at least `224`. -The images have to be loaded in to a range of `[0, 1]` and then normalized using `mean = [0.485, 0.456, 0.406]` -and `std = [0.229, 0.224, 0.225]`. - -Here's a sample execution. +모든 사전훈련된 모델은 입력 이미지가 같은 방식으로 정규화되었다고 가정합니다. +즉, 미니배치(mini-batch)의 3채널 RGB 이미지들은 `(3 x H x W)`의 shape을 가지며, `H`와 `W`는 최소 `224`이상이어야 하며, 각 이미지들은 `[0, 1]`의 범위에서 로드되어야 하며, 그 다음 `mean = [0.485, 0.456, 0.406]` 과 `std = [0.229, 0.224, 0.225]`를 이용해 정규화되어야 합니다. +아래 예시 코드가 있습니다. ```python -# Download an example image from the pytorch website +# 파이토치 웹 사이트에서 다운로드한 이미지 입니다. import urllib url, filename = ("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg") try: urllib.URLopener().retrieve(url, filename) @@ -41,7 +31,7 @@ except: urllib.request.urlretrieve(url, filename) ``` ```python -# sample execution (requires torchvision) +# 예시 코드 (torchvision 필요) from PIL import Image from torchvision import transforms input_image = Image.open(filename) @@ -52,18 +42,18 @@ preprocess = transforms.Compose([ transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), ]) input_tensor = preprocess(input_image) -input_batch = input_tensor.unsqueeze(0) # create a mini-batch as expected by the model +input_batch = input_tensor.unsqueeze(0) # 모델에서 가정하는대로 미니배치 생성 -# move the input and model to GPU for speed if available +# gpu를 사용할 수 있다면, 속도를 위해 입력과 모델을 gpu로 옮김 if torch.cuda.is_available(): input_batch = input_batch.to('cuda') model.to('cuda') with torch.no_grad(): output = model(input_batch) -# Tensor of shape 1000, with confidence scores over Imagenet's 1000 classes +# output은 shape가 [1000]인 Tensor 자료형이며, 이는 Imagenet 데이터셋의 각 클래스에 대한 모델의 확신도(confidence)를 나타냄. print(output[0]) -# The output has unnormalized scores. To get probabilities, you can run a softmax on it. +# output은 정규화되지 않았으므로, 확률화하기 위해 softmax 함수를 처리합니다. probabilities = torch.nn.functional.softmax(output[0], dim=0) print(probabilities) ``` From 956a16be1646727423ab913379767dacbc363f72 Mon Sep 17 00:00:00 2001 From: Junyong Kang <46196781+FollowerOfScriabin@users.noreply.github.com> Date: Sun, 24 Jul 2022 16:44:12 +0900 Subject: [PATCH 2/5] Update pytorch_vision_resnext.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *오타수정 --- pytorch_vision_resnext.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pytorch_vision_resnext.md b/pytorch_vision_resnext.md index 9f95637..70fe535 100644 --- a/pytorch_vision_resnext.md +++ b/pytorch_vision_resnext.md @@ -1,4 +1,11 @@ - +--- +layout: hub_detail +background-class: hub-background +body-class: hub +title: ResNext +summary: Next generation ResNets, more efficient and accurate +category: researchers +image: resnext.png author: Pytorch Team tags: [vision, scriptable] github-link: https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py From a012a4e5f96bc42e94e025c354c10ba04e865df7 Mon Sep 17 00:00:00 2001 From: Junyong Kang <46196781+FollowerOfScriabin@users.noreply.github.com> Date: Fri, 29 Jul 2022 19:18:28 +0900 Subject: [PATCH 3/5] Modify pytorch_vision_resnext.md : translate english to korean MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 초역본 --- pytorch_vision_resnext.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pytorch_vision_resnext.md b/pytorch_vision_resnext.md index 70fe535..11c4206 100644 --- a/pytorch_vision_resnext.md +++ b/pytorch_vision_resnext.md @@ -66,16 +66,16 @@ print(probabilities) ``` ``` -# Download ImageNet labels +# ImageNet 데이터셋 레이블 다운로드 !wget https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt ``` ``` -# Read the categories +# 카테고리(클래스) 읽기 with open("imagenet_classes.txt", "r") as f: categories = [s.strip() for s in f.readlines()] -# Show top categories per image +# 각 이미지에 대한 top 5 카테고리 출력 top5_prob, top5_catid = torch.topk(probabilities, 5) for i in range(top5_prob.size(0)): @@ -84,10 +84,10 @@ for i in range(top5_prob.size(0)): ### Model Description -Resnext models were proposed in [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/abs/1611.05431). -Here we have the 2 versions of resnet models, which contains 50, 101 layers repspectively. -A comparison in model archetechure between resnet50 and resnext50 can be found in Table 1. -Their 1-crop error rates on imagenet dataset with pretrained models are listed below. +Resnext 모델은 논문 [Aggregated Residual Transformations for Deep Neural Networks]에서 제안되었습니다. (https://arxiv.org/abs/1611.05431). +이중 두가지 버전의 모델 성능은 아래와 같습니다. 각 모델의 레이어 개수는 각 50, 101개입니다. +resnet50과 resnext50의 아키텍처 차이는 논문의 Table 1을 참고하십시오. +ImageNet 데이터셋에 대한 사전훈련된 모델의 에러(성능)은 아래 표와 같습니다. | Model structure | Top-1 error | Top-5 error | | ----------------- | ----------- | ----------- | @@ -96,4 +96,4 @@ Their 1-crop error rates on imagenet dataset with pretrained models are listed b ### References - - [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/abs/1611.05431) + - [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/abs/1611.05431) \ No newline at end of file From 01fedfd1d45a872fd2c0a29efeee9e4240a03ba6 Mon Sep 17 00:00:00 2001 From: Junyong Kang <46196781+FollowerOfScriabin@users.noreply.github.com> Date: Fri, 29 Jul 2022 19:32:37 +0900 Subject: [PATCH 4/5] Modify pytorch_vision_resnext.md : translate english to korean MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +번역 일부 수정 --- pytorch_vision_resnext.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pytorch_vision_resnext.md b/pytorch_vision_resnext.md index 11c4206..ea763f2 100644 --- a/pytorch_vision_resnext.md +++ b/pytorch_vision_resnext.md @@ -25,9 +25,10 @@ model = torch.hub.load('pytorch/vision:v0.10.0', 'resnext50_32x4d', pretrained=T model.eval() ``` -모든 사전훈련된 모델은 입력 이미지가 같은 방식으로 정규화되었다고 가정합니다. -즉, 미니배치(mini-batch)의 3채널 RGB 이미지들은 `(3 x H x W)`의 shape을 가지며, `H`와 `W`는 최소 `224`이상이어야 하며, 각 이미지들은 `[0, 1]`의 범위에서 로드되어야 하며, 그 다음 `mean = [0.485, 0.456, 0.406]` 과 `std = [0.229, 0.224, 0.225]`를 이용해 정규화되어야 합니다. -아래 예시 코드가 있습니다. +모든 사전 훈련된 모델들은 입력 이미지가 동일한 방식으로 정규화되었다고 상정합니다. +즉, 미니 배치(mini-batch)의 3-채널 RGB 이미지들은 `(3 x H x W)`의 형태를 가지며, 해당 `H`와 `W`는 최소 `224` 이상이어야 합니다. +각 이미지는 `[0, 1]`의 범위 내에서 로드되어야 하며, `mean = [0.485, 0.456, 0.406]` 과 `std = [0.229, 0.224, 0.225]`을 이용해 정규화되어야 합니다. +다음은 실행 예제 입니다. ```python # 파이토치 웹 사이트에서 다운로드한 이미지 입니다. From f28b188958c745efbf5c7f03c9bf4d4e58fe3ac3 Mon Sep 17 00:00:00 2001 From: Junyong Kang <46196781+FollowerOfScriabin@users.noreply.github.com> Date: Fri, 29 Jul 2022 19:39:50 +0900 Subject: [PATCH 5/5] Modify pytorch_vision_resnext.md : translate english to korean MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +2차수정 --- pytorch_vision_resnext.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pytorch_vision_resnext.md b/pytorch_vision_resnext.md index ea763f2..968ec4e 100644 --- a/pytorch_vision_resnext.md +++ b/pytorch_vision_resnext.md @@ -83,18 +83,18 @@ for i in range(top5_prob.size(0)): print(categories[top5_catid[i]], top5_prob[i].item()) ``` -### Model Description +### 모델 설명 Resnext 모델은 논문 [Aggregated Residual Transformations for Deep Neural Networks]에서 제안되었습니다. (https://arxiv.org/abs/1611.05431). 이중 두가지 버전의 모델 성능은 아래와 같습니다. 각 모델의 레이어 개수는 각 50, 101개입니다. resnet50과 resnext50의 아키텍처 차이는 논문의 Table 1을 참고하십시오. ImageNet 데이터셋에 대한 사전훈련된 모델의 에러(성능)은 아래 표와 같습니다. -| Model structure | Top-1 error | Top-5 error | +| 모델 구조 | Top-1 오류 | Top-5 오류 | | ----------------- | ----------- | ----------- | | resnext50_32x4d | 22.38 | 6.30 | | resnext101_32x8d | 20.69 | 5.47 | -### References +### 참고문헌 - [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/abs/1611.05431) \ No newline at end of file