Maskrcnn----python小知识点记录

1.sys.stdout,sys.stderr,print

1.1print与sys.stdout

print语句就是调用sys.stdout.write()这个方法。下面这篇博文讲得不错
参考这篇博文
python的print与sys.stdout

1.2 sys.stdout与sys.stderr

stderr与stdout一样,用于重定向错误信息至某个文件

>>> import sys
>>> sys.stderr = open('errlog.txt','a')
>>> a /5

这个时候没有输出,同个目录下多了errlog.txt文件,打开文件,显示如下。上面的错误信息保存到errlog.txt文件了
在这里插入图片描述

2.logging

建议参考这篇 Python:使用logging模块记录日志

3.imgaug

用于做图片增强处理,感觉还是蛮不错的

from imgaug import augmenters as iaa
# 每次使用0~2个Augmenter来处理图片,每个batch中的Augmenters顺序一样。    
# Fliplr 0.5 is the probability, horizontally flip 50% of the images
augmentation = iaa.SomeOf((0, 2), [
        iaa.Fliplr(0.5),
        iaa.Flipud(0.5),
        iaa.OneOf([iaa.Affine(rotate=90),
                   iaa.Affine(rotate=180),                   
                   iaa.Affine(rotate=270)]),        
        iaa.Multiply((0.8, 1.5)),
        iaa.GaussianBlur(sigma=(0.0, 5.0))])

4.torch.device

torch.device 有cpu,或者cuda
torch.cuda.device_count()可以看用了多少GPU

>>> torch.device('cpu')
device(type='cpu')
>>> torch.device('cuda')
device(type='cuda')
torch.cuda.device_count()
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值