GithubHelp home page GithubHelp logo

yeephycho / widerface-to-tfrecord Goto Github PK

View Code? Open in Web Editor NEW
42.0 2.0 16.0 1.35 MB

parse WIDER FACE dataset to tensorflow tfrecord format for object detection api

License: Apache License 2.0

Python 100.00%
widerface tensorflow tfrecords face-detection

widerface-to-tfrecord's Introduction

widerface-to-tfrecord

parse WIDER FACE dataset to tensorflow tfrecord format for object detection api.

Dependencies

numpy

opencv 2.7

tensorflow > 1.0.1

Usage

Enter project root

git clone https://github.com/yeephycho/widerface-to-tfrecord.git
cd ~/widerface-to-tfrecord

Create simbolic link to WIDER FACE dataset

Unzip .zip file to folder "~/WIDER/WIDER_train" and make sure "wider_face_train_annot.txt" is under folder "~/WIDER".

ln -s ~/WIDER ./widerface-to-tfrecord/WIDER

Run the script

python widerface_To_TFRecord.py

License

Apache 2.0

Auther

Yeephycho

widerface-to-tfrecord's People

Contributors

yeephycho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

widerface-to-tfrecord's Issues

New Python3 port!

Hi!

Based on your work, I've released a Python3 port with some minor improvements!

Check it out here if you are interested.

I leave this issue here in case someone drops by here and needs the Python3 version.

Thanks for this work!

Some modifications needed

There was some errors.

  1. location of annotation

f = open("WIDER/wider_face_train_annot.txt")

I noticed in the Face annotations came in different file.

This solved it:

f = open("WIDER/wider_face_split/wider_face_train_bbx_gt.txt")

  1. Encoding issues

Some lines needed UTF-8 encoding in tf.train.Example() line

Original:

tf_example = tf.train.Example(features=tf.train.Features(feature={
'image/height': dataset_util.int64_feature(int(height)),
'image/width': dataset_util.int64_feature(int(width)),
'image/filename': dataset_util.bytes_feature(filename),
'image/source_id': dataset_util.bytes_feature(filename),
'image/key/sha256': dataset_util.bytes_feature(key.encode('utf8')),
'image/encoded': dataset_util.bytes_feature(encoded_image_data),
'image/format': dataset_util.bytes_feature('jpeg'.encode('utf8')),
'image/object/bbox/xmin': dataset_util.float_list_feature(xmins),
'image/object/bbox/xmax': dataset_util.float_list_feature(xmaxs),
'image/object/bbox/ymin': dataset_util.float_list_feature(ymins),
'image/object/bbox/ymax': dataset_util.float_list_feature(ymaxs),
'image/object/class/text': dataset_util.bytes_list_feature(classes_text),
'image/object/class/label': dataset_util.int64_list_feature(classes),
'image/object/difficult': dataset_util.int64_list_feature(int(0)),
'image/object/truncated': dataset_util.int64_list_feature(truncated),
'image/object/view': dataset_util.bytes_list_feature(poses),
}))

Updated code

tf_example = tf.train.Example(features=tf.train.Features(feature={
'image/height': dataset_util.int64_feature(int(height)),
'image/width': dataset_util.int64_feature(int(width)),
'image/filename': dataset_util.bytes_feature(filename.encode('utf8')),
'image/source_id': dataset_util.bytes_feature(filename.encode('utf8')),
'image/key/sha256': dataset_util.bytes_feature(key.encode('utf8')),
'image/encoded': dataset_util.bytes_feature(encoded_image_data),
'image/format': dataset_util.bytes_feature('jpeg'.encode('utf8')),
'image/object/bbox/xmin': dataset_util.float_list_feature(xmins),
'image/object/bbox/xmax': dataset_util.float_list_feature(xmaxs),
'image/object/bbox/ymin': dataset_util.float_list_feature(ymins),
'image/object/bbox/ymax': dataset_util.float_list_feature(ymaxs),
'image/object/class/text': dataset_util.bytes_list_feature([x.encode('utf8') for x in classes_text]),
'image/object/class/label': dataset_util.int64_list_feature(classes),
'image/object/difficult': dataset_util.int64_list_feature(int(0)),
'image/object/truncated': dataset_util.int64_list_feature(truncated),
'image/object/view': dataset_util.bytes_list_feature(poses),
}))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.