资源简介
基于TensorFlow的Faster R-CNN源码
目录结构
----data
----experiments
----faster_rcnn
----libs
代码片段和文件信息
import torch as t
from .voc_dataset import VOCBboxDataset
from skimage import transform as sktsf
from torchvision import transforms as tvtsf
from . import util
import numpy as np
from utils.config import opt
def inverse_normalize(img):
if opt.caffe_pretrain:
img = img + (np.array([122.7717 115.9465 102.9801]).reshape(3 1 1))
return img[::-1 : :]
# approximate un-normalize for visualize
return (img * 0.225 + 0.45).clip(min=0 max=1) * 255
def pytorch_normalze(img):
“““
https://github.com/pytorch/vision/issues/223
return appr -1~1 RGB
“““
normalize = tvtsf.Normalize(mean=[0.485 0.456 0.406]
std=[0.229 0.224 0.225])
img = normalize(t.from_numpy(img))
return img.numpy()
def caffe_normalize(img):
“““
return appr -125-125 BGR
“““
img = img[[2 1 0] : :] # RGB-BGR
img = img * 255
mean = np.array([122.7717 115.9465 102.9801]).reshape(3 1 1)
img = (img - mean).astype(np.float32 copy=True)
return img
def preprocess(img min_size=600 max_size=1000):
“““Preprocess an image for feature extraction.
The length of the shorter edge is scaled to :obj:‘self.min_size‘.
After the scaling if the length of the longer edge is longer than
:param min_size:
:obj:‘self.max_size‘ the image is scaled to fit the longer edge
to :obj:‘self.max_size‘.
After resizing the image the image is subtracted by a mean image value
:obj:‘self.mean‘.
Args:
img (~numpy.ndarray): An image. This is in CHW and RGB format.
The range of its value is :math:‘[0 255]‘.
(~numpy.ndarray): An image. This is in CHW and RGB format.
The range of its value is :math:‘[0 255]‘.
Returns:
~numpy.ndarray:
A preprocessed image.
“““
C H W = img.shape
scale1 = min_size / min(H W)
scale2 = max_size / max(H W)
scale = min(scale1 scale2)
img = img / 255.
img = sktsf.resize(img (C H * scale W * scale) mode=‘reflect‘)
# both the longer and shorter should be less than
# max_size and min_size
if opt.caffe_pretrain:
normalize = caffe_normalize
else:
normalize = pytorch_normalze
return normalize(img)
class Transform(object):
def __init__(self min_size=600 max_size=1000):
self.min_size = min_size
self.max_size = max_size
def __call__(self in_data):
img bbox label = in_data
_ H W = img.shape
img = preprocess(img self.min_size self.max_size)
_ o_H o_W = img.shape
scale = o_H / H
bbox = util.resize_bbox(bbox (H W) (o_H o_W))
# horizontally flip
img params = util.random_flip(
img x_random=True return_param=True)
bbox = util.flip_bbox(
bbox (o_H o_W) x_flip=params[‘x_flip‘])
return img bbox label scale
class Dataset:
def __init__(self opt):
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-01-24 07:26 Faster-RCNN-Pytorch-master\
文件 202434 2018-01-24 07:26 Faster-RCNN-Pytorch-master\Small_Test.ipynb
文件 20001 2018-01-24 07:26 Faster-RCNN-Pytorch-master\Train.ipynb
目录 0 2018-01-24 07:26 Faster-RCNN-Pytorch-master\data\
文件 0 2018-01-24 07:26 Faster-RCNN-Pytorch-master\data\__init__.py
文件 3998 2018-01-24 07:26 Faster-RCNN-Pytorch-master\data\dataset.py
文件 9720 2018-01-24 07:26 Faster-RCNN-Pytorch-master\data\util.py
文件 5592 2018-01-24 07:26 Faster-RCNN-Pytorch-master\data\voc_dataset.py
文件 123072 2018-01-24 07:26 Faster-RCNN-Pytorch-master\demo.jpg
目录 0 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\
文件 0 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\__init__.py
文件 8055 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\faster_rcnn.py
文件 13588 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\roi_module.py
文件 5899 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\rpn.py
目录 0 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\
文件 0 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\__init__.py
目录 0 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\__pycache__\
文件 152 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\__pycache__\__init__.cpython-36.pyc
文件 6481 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\__pycache__\bbox_tools.cpython-36.pyc
文件 4698 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\__pycache__\roi_sample.cpython-36.pyc
文件 4569 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\__pycache__\rpn_gt_loc_label.cpython-36.pyc
文件 6516 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\bbox_tools.py
目录 0 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\nms\
文件 75 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\nms\__init__.py
目录 0 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\nms\__pycache__\
文件 250 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\nms\__pycache__\__init__.cpython-36.pyc
文件 6361 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\nms\__pycache__\non_maximum_suppression.cpython-36.pyc
文件 303174 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\nms\_nms_gpu_post.c
文件 175576 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\nms\_nms_gpu_post.cpython-36m-x86_64-linux-gnu.so
文件 970 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\nms\_nms_gpu_post.pyx
文件 720 2018-01-24 07:26 Faster-RCNN-Pytorch-master\model\utils\nms\_nms_gpu_post_py.py
............此处省略31个文件信息
- 上一篇:IE成本预算 工时定额管理系统
- 下一篇:AMI编码、解码system view仿真
相关资源
- 基于深度学习网络模型的鱼群异常行
- TensorFlow视频教程
- 七月在线_深度学习_矩阵与凸优化_第
- BP神经网络详解
- 计算机视觉中的注意力机制Visual Att
- RNN和LSTM原理
- 概率深度学习:反向传播贝叶斯
- 百度云 win10 深度学习环境 cuda_9.0.17
- 基于Tensorflow实现BNBatch Normalization的代
- ImageNet_mini数据集链接
- 深度学习、优化与识别彩色&高清&详尽
- cuda9.1+配套cudnn
- google word2vec开源项目
- maogoushibie.zip
- Faster-RCNN 代码
- Relation Classification via Convolutional Deep
- 吴恩达-李飞飞-林轩田等机器学习深度
- wide&deep;.zip
- Complex-YOLO
- VGG19网络参数——mat格式文件
- LSTM中timesteps的理解
-
ob
ject Detection 目标检测 思维导图 - 图像相似度 感知相似度计算代码
- Pytorch模型权重转变为Keras对应的模型
- 吴恩达老师深度学习第二课第二周2
- 机器学习、深度学习和算法结构框架
- Deepnude.txt134103
- 航空公司预测乘客数量--测试过小
- 深度学习之TensorFlow 入门、原理与进阶
- 深度学习方法在图像处理中的应用与
评论
共有 条评论