Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion docs/source/flowvision.models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Pretrain Models for Visual Tasks
Classification
==============

The models subpackage contains definitions for the following model
The models' subpackage contains definitions for the following model

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个修改是错的,你可能没有去理解原文意思?

architectures for image classification:

- `AlexNet`_
Expand Down
8 changes: 4 additions & 4 deletions docs/source/tutorials/Getting Started.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Getting Started

## Installation
- To install latest stable release of flowvision:
- To install the latest stable release of flowvision:
```bash
pip install flowvision==0.1.0
```
Expand All @@ -14,7 +14,7 @@ pip install -e .

## Usage
### Create a model
In flowvision we support two ways to create a model.
Flowvision supports two ways to create a model:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Flowvision supports two ways to create a model:
FlowVision supports two ways to create a model:


- Import the target model from `flowvision.models`, e.g., create `alexnet` from flowvision

Expand Down Expand Up @@ -77,7 +77,7 @@ You can get the results like:
╘════════════════════════════════════════════╧══════════════╛
```

### Search for supported model by Wildcard
### Search for the supported model by Wildcard

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的大小写是遵循什么规范呢,为什么 "Wildcard“ 是单独大写的。

It is easy to search for model architectures by using Wildcard as below:
```python
from flowvision.models import ModelCreator
Expand Down Expand Up @@ -108,7 +108,7 @@ You can get the results like:
```

### List all models supported in flowvision
`ModelCreator.model_list` has similar function as `ModelCreator.model_table` but return a list object, which gives the user a more flexible way to check the supported model in flowvision.
`ModelCreator.model_list` has a similar function as `ModelCreator.model_table` but returns a list object, which gives the user a more flexible way to check the supported model in flowvision.
- List all models with pretrained weights
```python
from flowvision.models import ModelCreator
Expand Down
8 changes: 4 additions & 4 deletions flowvision/data/auto_augment.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ def auto_augment_transform(config_str, hparams):

:param config_str: String defining configuration of auto augmentation. Consists of multiple sections separated by
dashes ('-'). The first section defines the AutoAugment policy (one of 'v0', 'v0r', 'original', 'originalr').
The remaining sections, not order sepecific determine
The remaining sections, not order specific determine
* 'mstd' - float std deviation of magnitude noise applied

Example: 'original-mstd0.5' results in AutoAugment with original policy, magnitude_std 0.5
Expand Down Expand Up @@ -685,11 +685,11 @@ def rand_augment_transform(config_str, hparams):

:param config_str: String defining configuration of random augmentation. Consists of multiple sections separated by
dashes ('-'). The first section defines the specific variant of rand augment (currently only 'rand'). The remaining
sections, not order sepecific determine
sections, not order specific determine

* 'm' - integer magnitude of rand augment
* 'n' - integer num layers (number of transform ops selected per image)
* 'w' - integer probabiliy weight index (index of a set of weights to influence choice of op)
* 'w' - integer probability weight index (index of a set of weights to influence choice of op)
* 'mstd' - float std deviation of magnitude noise applied, or uniform sampling if infinity (or > 100)
* 'mmax' - set upper bound for magnitude to something other than default of _LEVEL_DENOM (10)
* 'inc' - integer (bool), use augmentations that increase in severity with magnitude (default: 0)
Expand Down Expand Up @@ -850,7 +850,7 @@ def augment_and_mix_transform(config_str, hparams):

:param config_str: String defining configuration of random augmentation. Consists of multiple sections separated by
dashes ('-'). The first section defines the specific variant of rand augment (currently only 'rand'). The remaining
sections, not order sepecific determine
sections, not order specific determine

* 'm' - integer magnitude (severity) of augmentation mix (default: 3)
* 'w' - integer width of augmentation chain (default: 3)
Expand Down
2 changes: 1 addition & 1 deletion flowvision/data/mixup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def mixup_target(target, num_classes, lam=1.0, smoothing=0.0, device="cuda"):

def rand_bbox(img_shape, lam, margin=0.0, count=None):
""" Standard CutMix bounding-box
Generates a random square bbox based on lambda value. This impl includes
generates a random square bbox based on lambda value. This impl includes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
generates a random square bbox based on lambda value. This impl includes
generates a random square bbox based on lambda value. This implementation includes

impl 是什么意思?

support for enforcing a border margin as percent of bbox dimensions.

Args:
Expand Down
4 changes: 2 additions & 2 deletions flowvision/data/random_erasing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RandomErasing:
or single image tensor after it has been normalized by dataset mean and std.

Args:
probability: Probability that the Random Erasing operation will be performed
probability: Probability that the RandomErasing operation will be performed
min_area: Minimum percentage of erased area wrt input image area
max_area: Maximum percentage of erased area wrt input image area
min_aspect: Minimum aspect ratio of erased area
Expand All @@ -36,7 +36,7 @@ class RandomErasing:
* 'rand' - erase block is same per-channel random (normal) color
* 'pixel' - erase block is per-pixel random (normal) color

max_count: Maximum number of erasing blocks per image, area per box is scaled by count.
max_count: Maximum number of erasing blocks per image, and area per box is scaled by count.
per-image count is randomly chosen between 1 and this value
"""

Expand Down
4 changes: 2 additions & 2 deletions flowvision/models/detection/faster_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class FasterRCNN(GeneralizedRCNN):
The input to the model is expected to be a list of tensors, each of shape [C, H, W], one for each
image, and should be in 0-1 range. Different images can have different sizes.

The behavior of the model changes depending if it is in training or evaluation mode.
The behavior of the model changes depending on if it is in training or evaluation mode.

During training, the model expects both the input tensors, as well as a targets (list of dictionary),
containing:
Expand Down Expand Up @@ -317,7 +317,7 @@ def fasterrcnn_resnet50_fpn(
The input to the model is expected to be a list of tensors, each of shape ``[C, H, W]``, one for each
images, and should be in ``0-1`` range. Different images can have different sizes.

The behavior of the model changes depending if it is in training or evaluation mode.
The behavior of the model changes depending on if it is in training or evaluation mode.

During training, the model expects both the input tensors, as well as a targets (list of dictionary),
containing:
Expand Down
4 changes: 2 additions & 2 deletions flowvision/models/detection/fcos.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class FCOS(nn.Module):
The input to the model is expected to be a list of tensors, each of shape [C, H, W], one for each
image, and should be in 0-1 range. Different images can have different sizes.

The behavior of the model changes depending if it is in training or evaluation mode.
The behavior of the model changes depending on if it is in training or evaluation mode.

During training, the model expects both the input tensors, as well as a targets (list of dictionary),
containing:
Expand Down Expand Up @@ -729,7 +729,7 @@ def fcos_resnet50_fpn(
The input to the model is expected to be a list of tensors, each of shape ``[C, H, W]``, one for each
image, and should be in ``0-1`` range. Different images can have different sizes.

The behavior of the model changes depending if it is in training or evaluation mode.
The behavior of the model changes depending on if it is in training or evaluation mode.

During training, the model expects both the input tensors, as well as a targets (list of dictionary),
containing:
Expand Down
4 changes: 2 additions & 2 deletions flowvision/models/detection/mask_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MaskRCNN(FasterRCNN):
The input to the model is expected to be a list of tensors, each of shape [C, H, W], one for each
image, and should be in 0-1 range. Different images can have different sizes.

The behavior of the model changes depending if it is in training or evaluation mode.
The behavior of the model changes depending on if it is in training or evaluation mode.

During training, the model expects both the input tensors, as well as a targets (list of dictionary),
containing:
Expand Down Expand Up @@ -275,7 +275,7 @@ def maskrcnn_resnet50_fpn(
The input to the model is expected to be a list of tensors, each of shape ``[C, H, W]``, one for each
image, and should be in ``0-1`` range. Different images can have different sizes.

The behavior of the model changes depending if it is in training or evaluation mode.
The behavior of the model changes depending on if it is in training or evaluation mode.
During training, the model expects both the input tensors, as well as a targets (list of dictionary),
containing:

Expand Down
4 changes: 2 additions & 2 deletions flowvision/models/detection/retinanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ class RetinaNet(nn.Module):
The input to the model is expected to be a list of tensors, each of shape [C, H, W], one for each
image, and should be in 0-1 range. Different images can have different sizes.

The behavior of the model changes depending if it is in training or evaluation mode.
The behavior of the model changes depending on if it is in training or evaluation mode.

During training, the model expects both the input tensors, as well as a targets (list of dictionary),
containing:
Expand Down Expand Up @@ -670,7 +670,7 @@ def retinanet_resnet50_fpn(
The input to the model is expected to be a list of tensors, each of shape ``[C, H, W]``, one for each
image, and should be in ``0-1`` range. Different images can have different sizes.

The behavior of the model changes depending if it is in training or evaluation mode.
The behavior of the model changes depending on if it is in training or evaluation mode.

During training, the model expects both the input tensors, as well as a targets (list of dictionary),
containing:
Expand Down
6 changes: 3 additions & 3 deletions flowvision/models/detection/ssd.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class SSD(nn.Module):
image, and should be in 0-1 range. Different images can have different sizes but they will be resized
to a fixed size before passing it to the backbone.

The behavior of the model changes depending if it is in training or evaluation mode.
The behavior of the model changes depending on if it is in training or evaluation mode.

During training, the model expects both the input tensors, as well as a targets (list of dictionary),
containing:
Expand Down Expand Up @@ -604,10 +604,10 @@ def ssd300_vgg16(
Reference: `"SSD: Single Shot MultiBox Detector" <https://arxiv.org/abs/1512.02325>`_.

The input to the model is expected to be a list of tensors, each of shape [C, H, W], one for each
image, and should be in 0-1 range. Different images can have different sizes but they will be resized
image, and should be in 0-1 range. Different images can have different sizes, but they will be resized
to a fixed size before passing it to the backbone.

The behavior of the model changes depending if it is in training or evaluation mode.
The behavior of the model changes depending on if it is in training or evaluation mode.

During training, the model expects both the input tensors, as well as a targets (list of dictionary),
containing:
Expand Down
2 changes: 1 addition & 1 deletion flowvision/transforms/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ def rotate(

def rgb_to_grayscale(img: Tensor, num_output_channels: int = 1) -> Tensor:
"""Convert RGB image to grayscale version of image.
If the image is flow Tensor, it is expected
If the image is oneflow Tensor, it is expected
to have [..., 3, H, W] shape, where ... means an arbitrary number of leading dimensions

Note:
Expand Down
22 changes: 11 additions & 11 deletions flowvision/transforms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def __call__(self, img):


class RandomChoice(RandomTransforms):
"""Apply single transformation randomly picked from a list.
"""Apply a single transformation randomly picked from a list.
"""

def __call__(self, img):
Expand Down Expand Up @@ -635,7 +635,7 @@ def __repr__(self):

class RandomHorizontalFlip(Module):
"""Horizontally flip the given image randomly with a given probability.
If the image is flow Tensor, it is expected
If the image is oneflow Tensor, it is expected
to have [..., H, W] shape, where ... means an arbitrary number of leading
dimensions

Expand Down Expand Up @@ -666,7 +666,7 @@ def __repr__(self):

class RandomVerticalFlip(Module):
"""Vertically flip the given image randomly with a given probability.
If the image is flow Tensor, it is expected
If the image is oneflow Tensor, it is expected
to have [..., H, W] shape, where ... means an arbitrary number of leading
dimensions

Expand Down Expand Up @@ -698,7 +698,7 @@ def __repr__(self):
class RandomResizedCrop(Module):
"""Crop a random portion of image and resize it to a given size.

If the image is flow Tensor, it is expected
If the image is oneflow Tensor, it is expected
to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions

A crop of the original image is made: the crop has a random area (H * W)
Expand Down Expand Up @@ -833,7 +833,7 @@ def __init__(self, *args, **kwargs):

class FiveCrop(Module):
"""Crop the given image into four corners and the central crop.
If the image is flow Tensor, it is expected
If the image is oneflow Tensor, it is expected
to have [..., H, W] shape, where ... means an arbitrary number of leading
dimensions

Expand Down Expand Up @@ -882,7 +882,7 @@ def __repr__(self):
class TenCrop(Module):
"""Crop the given image into four corners and the central crop plus the flipped version of
these (horizontal flipping is used by default).
If the image is flow Tensor, it is expected
If the image is oneflow Tensor, it is expected
to have [..., H, W] shape, where ... means an arbitrary number of leading
dimensions

Expand Down Expand Up @@ -934,7 +934,7 @@ def __repr__(self):

class ColorJitter(Module):
"""Randomly change the brightness, contrast, saturation and hue of an image.
If the image is flow Tensor, it is expected
If the image is oneflow Tensor, it is expected
to have [..., 3, H, W] shape, where ... means an arbitrary number of leading dimensions.
If img is PIL Image, mode "1", "L", "I", "F" and modes with transparency (alpha channel) are not supported.

Expand Down Expand Up @@ -1078,7 +1078,7 @@ def __repr__(self):

class RandomRotation(Module):
"""Rotate the image by angle.
If the image is flow Tensor, it is expected
If the image is oneflow Tensor, it is expected
to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions.

Args:
Expand Down Expand Up @@ -1190,7 +1190,7 @@ def __repr__(self):

class RandomGrayscale(Module):
"""Randomly convert image to grayscale with a probability of p (default 0.1).
If the image is flow Tensor, it is expected
If the image is oneflow Tensor, it is expected
to have [..., 3, H, W] shape, where ... means an arbitrary number of leading dimensions

Args:
Expand Down Expand Up @@ -1278,14 +1278,14 @@ def __init__(self, kernel_size, sigma=(0.1, 2.0)):

@staticmethod
def get_params(sigma_min: float, sigma_max: float) -> float:
"""Choose sigma for random gaussian blurring.
"""Choose sigma for random Gaussian blurring.

Args:
sigma_min (float): Minimum standard deviation that can be chosen for blurring kernel.
sigma_max (float): Maximum standard deviation that can be chosen for blurring kernel.

Returns:
float: Standard deviation to be passed to calculate kernel for gaussian blurring.
float: Standard deviation to be passed to calculate kernel for Gaussian blurring.
"""
return flow.empty(1).uniform_(sigma_min, sigma_max).item()

Expand Down
2 changes: 1 addition & 1 deletion flowvision/utils/clip_grad.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def dispatch_clip_grad(

Args:
parameters (Iterable): model parameters to clip
value (float): clipping value/factor/norm, mode dependant
value (float): clipping value/factor/norm, mode dependent
mode (str): clipping mode, one of 'norm', 'value', 'agc'
norm_type (float): p-norm, default 2.0
"""
Expand Down