1 Star 0 Fork 0

jx0913/tensorflow-yolov3

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
show_input_image.py 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
YunYang1994 提交于 2019-01-27 23:23 . I hate tensorflow
#! /usr/bin/env python
# coding=utf-8
#================================================================
# Copyright (C) 2019 * Ltd. All rights reserved.
#
# Editor : VIM
# File name : debug.py
# Author : YunYang1994
# Created date: 2019-01-21 15:02:05
# Description :
#
#================================================================
import cv2
import numpy as np
import tensorflow as tf
from core import utils
from PIL import Image
from core.dataset import Parser, dataset
sess = tf.Session()
IMAGE_H, IMAGE_W = 416, 416
BATCH_SIZE = 1
SHUFFLE_SIZE = 1
train_tfrecord = "./raccoon_dataset/raccoon_*.tfrecords"
anchors = utils.get_anchors('./data/raccoon_anchors.txt', IMAGE_H, IMAGE_W)
classes = utils.read_coco_names('./data/raccoon.names')
num_classes = len(classes)
parser = Parser(IMAGE_H, IMAGE_W, anchors, num_classes, debug=True)
trainset = dataset(parser, train_tfrecord, BATCH_SIZE, shuffle=SHUFFLE_SIZE)
is_training = tf.placeholder(tf.bool)
example = trainset.get_next()
for l in range(10):
image, boxes = sess.run(example)
image, boxes = image[0], boxes[0]
n_box = len(boxes)
for i in range(n_box):
image = cv2.rectangle(image,(int(float(boxes[i][0])),
int(float(boxes[i][1]))),
(int(float(boxes[i][2])),
int(float(boxes[i][3]))), (255,0,0), 1)
label = classes[boxes[i][4]]
image = cv2.putText(image, label, (int(float(boxes[i][0])),int(float(boxes[i][1]))),
cv2.FONT_HERSHEY_SIMPLEX, .6, (0, 255, 0), 1, 2)
image = Image.fromarray(np.uint8(image))
image.show()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/jx0913/tensorflow-yolov3.git
git@gitee.com:jx0913/tensorflow-yolov3.git
jx0913
tensorflow-yolov3
tensorflow-yolov3
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385