失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > python 文件头注释和函数 类注释示例

python 文件头注释和函数 类注释示例

时间:2020-08-18 10:15:28

相关推荐

python 文件头注释和函数  类注释示例

1、 文件头注释

# -*- coding: utf-8 -*-"""@Author : ***@License : (C) Copyright -20****@Contact : ***@File : pr*****res.py@Software: rec***nd@Time : /05/06 15:06@Desc : 0506 v1.0"""

2、函数 、类注释示例

class RandomResizedCropAndInterpolationWithTwoPic:"""Crop the given PIL Image to random size and aspect ratio with random interpolation.A crop of random size (default: of 0.08 to 1.0) of the original size and a randomaspect ratio (default: of 3/4 to 4/3) of the original aspect ratio is made. This cropis finally resized to given size.This is popularly used to train the Inception networks.Args:size: expected output size of each edgescale: range of size of the origin size croppedratio: range of aspect ratio of the origin aspect ratio croppedinterpolation: Default: PIL.Image.BILINEAR"""def __init__(self, size, second_size=None, scale=(0.08, 1.0), ratio=(3. / 4., 4. / 3.),interpolation='bilinear', second_interpolation='lanczos'):

@staticmethoddef get_params(img, scale, ratio):"""Get parameters for ``crop`` for a random sized crop.Args:img (PIL Image): Image to be cropped.scale (tuple): range of size of the origin size croppedratio (tuple): range of aspect ratio of the origin aspect ratio croppedReturns:tuple: params (i, j, h, w) to be passed to ``crop`` for a randomsized crop."""

如果觉得《python 文件头注释和函数 类注释示例》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。