• 大小: 2.96MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-10
  • 语言: Python
  • 标签: Faster-RCNN  

资源简介

Faster-RCNN-TensorFlow-Python3.5-masterFaster-RCNN-TensorFlow-Python3.5-master

资源截图

代码片段和文件信息

#!/usr/bin/env python

# --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Xinlei Chen based on code from Ross Girshick
# --------------------------------------------------------

“““
Demo script showing detections in sample images.

See README.md for installation instructions before running.
“““
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import argparse
import os

import cv2
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from lib.config import config as cfg
from lib.utils.nms_wrapper import nms
from lib.utils.test import im_detect
#from nets.resnet_v1 import resnetv1
from lib.nets.vgg16 import vgg16
from lib.utils.timer import Timer

CLASSES = (‘__background__‘
           ‘aeroplane‘ ‘bicycle‘ ‘bird‘ ‘boat‘
           ‘bottle‘ ‘bus‘ ‘car‘ ‘cat‘ ‘chair‘
           ‘cow‘ ‘diningtable‘ ‘dog‘ ‘horse‘
           ‘motorbike‘ ‘person‘ ‘pottedplant‘
           ‘sheep‘ ‘sofa‘ ‘train‘ ‘tvmonitor‘)

NETS = {‘vgg16‘: (‘vgg16_faster_rcnn_iter_70000.ckpt‘) ‘res101‘: (‘res101_faster_rcnn_iter_110000.ckpt‘)}
DATASETS = {‘pascal_voc‘: (‘voc_2007_trainval‘) ‘pascal_voc_0712‘: (‘voc_2007_trainval+voc_2012_trainval‘)}


def vis_detections(im class_name dets thresh=0.5):
    “““Draw detected bounding boxes.“““
    inds = np.where(dets[: -1] >= thresh)[0]
    if len(inds) == 0:
        return

    im = im[: : (2 1 0)]
    fig ax = plt.subplots(figsize=(12 12))
    ax.imshow(im aspect=‘equal‘)
    for i in inds:
        bbox = dets[i :4]
        score = dets[i -1]

        ax.add_patch(
            plt.Rectangle((bbox[0] bbox[1])
                          bbox[2] - bbox[0]
                          bbox[3] - bbox[1] fill=False
                          edgecolor=‘red‘ linewidth=3.5)
        )
        ax.text(bbox[0] bbox[1] - 2
                ‘{:s} {:.3f}‘.format(class_name score)
                bbox=dict(facecolor=‘blue‘ alpha=0.5)
                fontsize=14 color=‘white‘)

    ax.set_title((‘{} detections with ‘
                  ‘p({} | box) >= {:.1f}‘).format(class_name class_name
                                                  thresh)
                 fontsize=14)
    plt.axis(‘off‘)
    plt.tight_layout()
    plt.draw()


def demo(sess net image_name):
    “““Detect object classes in an image using pre-computed object proposals.“““

    # Load the demo image
    im_file = os.path.join(cfg.FLAGS2[“data_dir“] ‘demo‘ image_name)
    im = cv2.imread(im_file)

    # Detect all object classes and regress object bounds
    timer = Timer()
    timer.tic()
    scores boxes = im_detect(sess net im)
    timer.toc()
    print(‘Detection took {:.3f}s for {:d} object proposals‘.format(timer.total_time boxes.shape[0]))

    # Visualize detections for each class
    CONF_THRESH = 0.1
    NMS_THRESH = 0.1
    for c

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件          0  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\.gitignore

     文件        459  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\.idea\CardiacMRI3.iml

     文件         84  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\.idea\dictionaries\Deniz.xml

     文件        281  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\.idea\inspectionProfiles\Project_Default.xml

     文件        227  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\.idea\misc.xml

     文件        274  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\.idea\modules.xml

     文件      49525  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\.idea\workspace.xml

     文件         64  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\.gitignore

     文件       9875  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\common\gason.cpp

     文件       3619  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\common\gason.h

     文件       8479  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\common\maskApi.c

     文件       2236  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\common\maskApi.h

     文件       1559  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\license.txt

     文件      10987  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\LuaAPI\CocoApi.lua

     文件        814  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\LuaAPI\cocoDemo.lua

     文件        447  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\LuaAPI\env.lua

     文件        511  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\LuaAPI\init.lua

     文件      10439  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\LuaAPI\MaskApi.lua

     文件        857  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\LuaAPI\rocks\coco-scm-1.rockspec

     文件      14357  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\MatlabAPI\CocoApi.m

     文件       1234  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\MatlabAPI\cocoDemo.m

     文件      22798  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\MatlabAPI\CocoEval.m

     文件      16940  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\MatlabAPI\CocoUtils.m

     文件       1852  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\MatlabAPI\evalDemo.m

     文件       2448  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\MatlabAPI\gason.m

     文件       5095  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\MatlabAPI\MaskApi.m

     文件       9457  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\MatlabAPI\private\gasonMex.cpp

     文件      38020  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\MatlabAPI\private\gasonMex.mexa64

     文件      41452  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\MatlabAPI\private\gasonMex.mexmaci64

     文件       2994  2018-01-20 16:55  Faster-RCNN-TensorFlow-Python3.5-master\data\coco\MatlabAPI\private\getPrmDflt.m

............此处省略122个文件信息

评论

共有 条评论