• Stars
    star
    132
  • Rank 274,205 (Top 6 %)
  • Language
    Python
  • Created over 8 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The examples of image recognition with the dataset CIFAR10 via tensorflow.

tensorflow.cifar10

The examples of image recognition with the dataset CIFAR10 via tensorflow.

1 CIFAR-10 数据集

CIFAR-10数据集是机器学习中的一个通用的用于图像识别的基础数据集,官网链接为:The CIFAR-10 dataset

cifar10

下载使用的版本是:

version

将其解压后(代码中包含自动解压代码),内容为:

cifar10 data

cifar10 data2

2 测试代码

测试代码公布在GitHub:yhlleo

主要代码及作用:

文件 作用
cifar10_input.py 读取本地或者在线下载CIFAR-10的二进制文件格式数据集
cifar10.py 建立CIFAR-10的模型
cifar10_train.py 在CPU或GPU上训练CIFAR-10的模型
cifar10_multi_gpu_train.py 在多个GPU上训练CIFAR-10的模型
cifar10_eval.py 评估CIFAR-10模型的预测性能

该部分的代码,介绍了如何使用TensorFlow在CPU和GPU上训练和评估卷积神经网络(convolutional neural network, CNN)。

3 相关网页及教程

更加详细地介绍说明,请浏览网页:Convolutional Neural Networks

中文网站极客学院也有该部分的汉译版:卷积神经网络

代码源自tensorflow官网:tensorflow/models/image/cifar10

4 代码修改说明

GitHub公布代码相对源码,主要进行了以下修正:

  • cifar10.py
#indices = tf.reshape(tf.range(FLAGS.batch_size), [FLAGS.batch_size, 1])
indices = tf.reshape(range(FLAGS.batch_size), [FLAGS.batch_size, 1])

# or
indices = tf.reshape(tf.range(0, FLAGS.batch_size, 1), [FLAGS.batch_size, 1])

此处,源码编译时会出现以下错误:

  ...
  File ".../cifar10.py", line 271, in loss
    indices = tf.reshape(tf.range(FLAGS.batch_size), [FLAGS.batch_size, 1])
TypeError: range() takes at least 2 arguments (1 given)
  • cifar10_input_test.py
#self.assertEqual("%s:%d" % (filename, i), tf.compat.as_text(key))

import compat as cp
...

self.assertEqual("%s:%d" % (filename, i), cp.as_text(key))

不然的话,我测试的时候就会出现这的错误:

AttributeError: 'module' object has no attribute 'compat'
  • cifar10_train.pycifar10_multi_gpu_train.py

源代码里的最大迭代次数max_steps1000000,需要训练几个小时,不忍心折腾我的破笔记本,就改为了20000

其他改动,例如导入模块或者文件路径等,都很容易理解,就不列举了~

More Repositories

1

DeepSegmentor

A Pytorch implementation of DeepCrack and RoadNet projects.
Python
256
star
2

DeepCrack

DeepCrack: A Deep Hierarchical Feature Learning Architecture for Crack Segmentation, Neurocomputing.
211
star
3

VTs-Drloc

NeurIPS 2021, Official codes for "Efficient Training of Visual Transformers with Small Datasets".
Python
138
star
4

mnist

Some samples of the MNIST classifier.
Python
118
star
5

RoadNet

RoadNet: A Multi-task Benchmark Dataset for Road Detection, TGRS.
97
star
6

cifar10Dataset

Create your own dataset with the similar format with CIFAR10 in python version.
Python
87
star
7

GAN-Metrics

A collection of metrics for evaluating GAN models.
Python
55
star
8

imageBinaryDataset

C++
50
star
9

SmoothingLatentSpace

CVPR 2021, Smoothing the Disentangled Latent Style Space for Unsupervised I2I Translation
Python
41
star
10

MJP

An official Pytorch implementation of "Masked Jigsaw Puzzle: A Versatile Position Embedding for Vision Transformers", CVPR 2023.
Python
39
star
11

DWC-GAN

DWC-GAN, ACM MM 2020.
Python
32
star
12

uaggan

A Pytorch implementation of "Unsupervised Attention-Guided Image-to-Image Translation"
Python
29
star
13

TriangleGAN

TriangleGAN, ACM MM 2019.
Python
29
star
14

Domain-Translation-Papers

Collecting papers about domain translations.
21
star
15

frechet-bert-distance

Findings of ACL 2021
Python
21
star
16

stylegan-mmuit

ISF-GAN, TMM 2022.
Python
17
star
17

SuperpixelRegionFill

Superpixels-based region filling
C++
17
star
18

RG-UNIT

RG-UNIT, ACM MM 2020.
Python
11
star
19

ImageDataAugmentation

Image data augmentation via flipping and rotation.
C++
11
star
20

FindFilesWithinFolder

Find and generate a file list of the folder.
C++
7
star
21

Activations

A list of current activation functions in deep learning.
MATLAB
7
star
22

Reweighting

Reweighting Responses, EMNLP 2018 (short, oral)
Python
4
star
23

ImageFormatConversion

A Demo of converting the single channel 16-bit images to 8-bit images.
C
2
star
24

image2binarytest

C++
2
star
25

Create-Subfolder

Create a subfolder included in the input file path.
C++
1
star
26

QImage2Mat

The conversion between Qt QImage and OpenCV Mat.
C++
1
star