1、环境:win10+tensorflow-gpu==1.14.0

2、下载代码:到https://github.com/balancap/SSD-Tensorflow到本地

3、解压代码,并将checkpoints下的ssd_300_vgg.ckpt.zip进行解压在checkpoints目录下。否则后果不堪设想

4、如果你的电脑装有jupyter notebook.则将此SSD-Tensorflow文件复制在jupyter文件目录下,然后启动jupyter notebook。

打开notebooks下的ssd_notebook.ipynb文件,运行每个cell。

也可以将此ipynb下的所有代码复制在SSD_Tensorflow目录新建的ssd_python.py中,运行

也可以直接搜网上教程,新建py文件,复制代码,然后运行。

这个附上我复制的代码:(切记修改路径ckpt_file)

# coding: utf-8
# In[1]:import os
import math
import randomimport numpy as np
import tensorflow as tf
import cv2slim = tf.contrib.slim# In[2]:
import matplotlib.pyplot as plt
import matplotlib.image as mpimg# In[3]:import syssys.path.append('./')# In[4]:from nets import ssd_vgg_300, ssd_common, np_methods
from preprocessing import ssd_vgg_preprocessing
from notebooks import visualization# In[5]:# TensorFlow session: grow memory when needed. TF, DO NOT USE ALL MY GPU MEMORY!!!
gpu_options = tf.GPUOptions(allow_growth=True)
config = tf.ConfigProto(log_device_placement=False, gpu_options=gpu_options)
isess = tf.InteractiveSession(config=config)# ## SSD 300 Model
#
# The SSD 300 network takes 300x300 image inputs. In order to feed any image, the latter is resize to this input shape (i.e.`Resize.WARP_RESIZE`). Note that even though it may change the ratio width / height, the SSD model performs well on resized images (and it is the default behaviour in the original Caffe implementation).
#
# SSD anchors correspond to the default bounding boxes encoded in the network. The SSD net output provides offset on the coordinates and dimensions of these anchors.# In[6]:# Input placeholder.
net_shape = (300, 300)
data_format = 'NHWC'
img_input = tf.placeholder(tf.uint8, shape=(None, None, 3))
# Evaluation pre-processing: resize to SSD net shape.
image_pre, labels_pre, bboxes_pre, bbox_img = ssd_vgg_preprocessing.preprocess_for_eval(img_input, None, None, net_shape, data_format, resize=ssd_vgg_preprocessing.Resize.WARP_RESIZE)
image_4d = tf.expand_dims(image_pre, 0)# Define the SSD model.
reuse = True if 'ssd_net' in locals() else None
ssd_net = ssd_vgg_300.SSDNet()
with slim.arg_scope(ssd_net.arg_scope(data_format=data_format)):predictions, localisations, _, _ = ssd_net.net(image_4d, is_training=False, reuse=reuse)# Restore SSD model.
ckpt_filename = 'E:\gitcode\ssd\chde222-SSD-Tensorflow-master\SSD-Tensorflow\checkpoints/ssd_300_vgg.ckpt'
# ckpt_filename = '../checkpoints/VGG_VOC0712_SSD_300x300_ft_iter_120000.ckpt'
isess.run(tf.global_variables_initializer())
saver = tf.train.Saver()
saver.restore(isess, ckpt_filename)# SSD default anchor boxes.
ssd_anchors = ssd_net.anchors(net_shape)# ## Post-processing pipeline
#
# The SSD outputs need to be post-processed to provide proper detections. Namely, we follow these common steps:
#
# * Select boxes above a classification threshold;
# * Clip boxes to the image shape;
# * Apply the Non-Maximum-Selection algorithm: fuse together boxes whose Jaccard score > threshold;
# * If necessary, resize bounding boxes to original image shape.# In[7]:# Main image processing routine.
def process_image(img, select_threshold=0.5, nms_threshold=.45, net_shape=(300, 300)):# Run SSD network.rimg, rpredictions, rlocalisations, rbbox_img = isess.run([image_4d, predictions, localisations, bbox_img],feed_dict={img_input: img})# Get classes and bboxes from the net outputs.rclasses, rscores, rbboxes = np_methods.ssd_bboxes_select(rpredictions, rlocalisations, ssd_anchors,select_threshold=select_threshold, img_shape=net_shape, num_classes=21, decode=True)rbboxes = np_methods.bboxes_clip(rbbox_img, rbboxes)rclasses, rscores, rbboxes = np_methods.bboxes_sort(rclasses, rscores, rbboxes, top_k=400)rclasses, rscores, rbboxes = np_methods.bboxes_nms(rclasses, rscores, rbboxes, nms_threshold=nms_threshold)# Resize bboxes to original image shape. Note: useless for Resize.WARP!rbboxes = np_methods.bboxes_resize(rbbox_img, rbboxes)return rclasses, rscores, rbboxes# In[21]:# Test on some demo image and visualize output.
path = 'E:/gitcode/ssd/chde222-SSD-Tensorflow-master/SSD-Tensorflow/demo/'
image_names = sorted(os.listdir(path))img = mpimg.imread(path + image_names[-1])
rclasses, rscores, rbboxes = process_image(img)# visualization.bboxes_draw_on_img(img, rclasses, rscores, rbboxes, visualization.colors_plasma)
visualization.plt_bboxes(img, rclasses, rscores, rbboxes)

运行结果:

参考自https://blog.csdn.net/hezuo1181/article/details/91380182

Win10调试ssd_tensorflow的目标检测相关推荐

  1. win10,vs2015深度学习目标检测YOLOV5+deepsort C++多目标跟踪代码实现,源码注释,拿来即用。

    打死不用CSDN,整改的太恶心了,发什么都审核不过,各种图片和链接不让发.人如果没有立场那还是人吗?不用CSDN并且博客园就很好! DeepSort纯C++ Yolov5[s,l,m系列],详细讲解- ...

  2. Win10下 Swin Transformer目标检测环境配置流程

    Win10下 Swin-Transformer目标检测环境:对于第一次配置mmdetection的同学可能有所帮助. 1.版本环境介绍 Window 10 Visual Studio 2017 pyt ...

  3. tensorflow 目标检测API及jupyter notebook 虚拟环境配置

    环境 tensorflow == 2.8.0 win10 or linux 概要 目标检测项目的主要步骤如下: 搭建虚拟环境 采集图像并打标 训练 预测 模型的保存和转换 调优 项目部署 1. 搭建虚 ...

  4. 跑yolo3模型出的效果图_【目标检测实战】Darknet入门—yolov3模型训练(Win10下的安装、编译、实现)...

    效果图 简介 Yolo,是实时物体检测的算法系统,基于Darknet-一个用C和CUDA编写的开源神经网络框架.它快速,易于安装,并支持CPU和GPU计算,也是yolo的底层.本文主要介绍在win10 ...

  5. python实现yolo目标检测_Yolov5—实现目标检测(win10)

    Yolov5-实现目标检测(win10) 该方法可以在win10上实现Yolov5的目标检测,配置前需要安装Anaconda3 一.环境配置 源码下载地址:https://github.com/ult ...

  6. 【目标检测实验系列】使用yolov3 spp训练西工大遥感数据集NWPU VHR-10(包括如何将NWPU VHR-10转为VOC格式和yolov3 spp实验调试的详细步骤,且附上训练完的权重文件)

    目录 1. 文章主要内容 2. 西工大数据集转换为VOC格式数据集 2.1 VOC数据集结构 2.2 西工大数据集 2.3 转换格式 2.3.1 构建与VOC类似的数据集文件结构(文件夹名可以自定义) ...

  7. Yolov5—实现目标检测(win10)

    Yolov5-实现目标检测(win10) 该方法可以在win10上实现Yolov5的目标检测,配置前需要安装Anaconda3 一.环境配置 源码下载地址:https://github.com/ult ...

  8. SSD目标检测:tensorflow 版本调试以及出现错误的解决方法

    这里分享一下我在进行复现目标检测算法 SSD-Tensorflow 版本的调试经验. 首先贴上论文链接:SSD: Single Shot MultiBoxDetector Tensorflow 版本的 ...

  9. WIN10+YOLOv4 环境搭建并进行YOLOv4目标检测

    我的当前 软件环境:WIN10,CUDA10.2,cuDNN7.6.5,python3.7,VS2019,OpenCV3.4.0 硬件环境:Rtx2060,12G显存: 1.1 下载安装NVIDIA显 ...

最新文章

  1. MPB:中科院生态环境中心邓晔组-环境样本中原核生物的总量测定
  2. 密歇根大学联合谷歌大脑提出,通过「推断语义布局」实现「文本到图像合成」
  3. matlab人脸追踪,求大神帮助我这个菜鸟解决一下人脸跟踪这个程序的一些问题啊!!...
  4. 一个完整的DS1302时钟在STM32上的应用实例
  5. vue 给标签添加data属性_vue之data属性
  6. tcp http https
  7. DL之AlexNet:利用卷积神经网络类AlexNet实现猫狗分类识别(图片数据增强→保存h5模型)
  8. markdown 流程图js_科学网—让Markdown支持ASCII流程图和JavaScript流程图 - 李继存的博文...
  9. 40个最好的Tumblr主题
  10. 【华为云技术分享】大数据实践解析(下):Spark的读写流程分析
  11. C#设计模式之十一享元模式(Flyweight Pattern)【结构型】
  12. Python学习02 列表 List
  13. Unity 接入科大讯飞语音sdk
  14. 海康威视4路播放封装----安卓开发
  15. 记一次rm -rf之后的数据恢复操作
  16. Dmoz中文目录收录的中文博客
  17. python处理视频图像_图像/视频处理选项
  18. iOS Swift 使用 CLLocationManager 定位
  19. 《深渊古纪》古剑奇谭衍生小说 阅读笔记
  20. ES:ES支持的数据类型

热门文章

  1. Dubbo常见面试题与答案
  2. 安装python37路径报错_Robot framework安装python3.7导入HttpLibrary.HTTP报错
  3. ionic 修改组件默认样式_开源Magpie:组件库详解
  4. abap数据类型转换_ABAP 中JSON格式的转换与解析
  5. android10获取imei,Android 10 root用户获取imei
  6. linux查看etl进程,常见ETL工具
  7. arm中断保护和恢复_浅谈ARM处理器的七种异常处理
  8. 计算机桌面程序名,深度技术win7旗舰版电脑桌面图标只显示名称了怎么办
  9. catalog move.php,catalog.php
  10. c语言把数据存放在文件中,急求如何将下列C语言程序数据存储到文件中?