作者文章归档:daxiahy

05-使用训练好的分割模型

效果图

image

以下内容为tensorflow官方测试代码,仅用于测试自己模型训练的效果,不是训练代码

导包

import warnings
warnings.filterwarnings("ignore")
import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile

from distutils.version import StrictVersion
from collections import 

阅读全文 →

04-使用训练好的分割模型

mask_rcnn_inception_v2_coco.config

# Mask R-CNN with Inception V2
# Configured for MSCOCO Dataset.
# Users should configure the fine_tune_checkpoint field in the train config as
# well as the label_map_path and input_path fields in the train_input_reader and
# eval_input_reader. Search for "PATH_TO_

阅读全文 →

03-使用训练好的分割模型

string_int_label_map_pb2.py

# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: object_detection/protos/string_int_label_map.proto

import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from goo

阅读全文 →

02-使用训练好的分割模型

export_inference_graph.py

# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licen

阅读全文 →

01-使用训练好的分割模型

下载模型

地址: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md

# 这个模型速度快 轻量级
http://download.tensorflow.org/models/object_detection/mask_rcnn_inception_v2_coco_2018_01_28.tar.gz

训练自己的分割模型

1. 准备好训练图片

  • 训练集的图片必须小于1M,手机拍摄的原图会让CPU内存爆炸

  • 标注产生的json文件必须和标图片在一

阅读全文 →

多分类图像识别

训练自己的分类模型

基于inception v3

介绍

下载 inception v3 模型

http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz

其中的 ++classify_image_graph_def.pb++ 文件就是模型文件,但是pb文件只能使用,不能继续训练。

++imagenet_synset_to_human_label_map.txt++ ++imagenet_2012_challenge_label_map_proto.pbtxt++ 这两个文件是数字编号对应物品英文描

阅读全文 →

vgg16实现是否戴口罩分类

from keras.applications.vgg16 import VGG16
from keras.models import Sequential
from keras.layers import Conv2D,MaxPool2D,Activation,Dropout,Flatten,Dense
from keras.optimizers import SGD
from keras.preprocessing.image import ImageDataGenerator,img_to_array,load_img
import numpy as np
#VGG16是用image

阅读全文 →

简单cnn实现戴口罩识别

import keras
from keras.models import Sequential
from keras.layers import Conv2D,MaxPool2D,Dense,Dropout,Flatten
from keras.optimizers import Adam
from keras.preprocessing.image import load_img,ImageDataGenerator,img_to_array
# 定义模型

model = Sequential()

model.add(Conv2D(input_shape=(150,150,3),f

阅读全文 →

生成式对抗网络GAN

import numpy as np
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten, Reshape
from keras.layers import Conv2D, Conv2DTranspose, UpSampling2D
from keras.layers import LeakyReLU, Dropout
from keras.layers import BatchNormalization

阅读全文 →