Coder Social home page Coder Social logo

tensorflow-workspace's Introduction

Tensorflow Workspace for K210

Classifier for ImageNet

  1. Download ImageNet dataset, extract it as the instructions to ILSVRC2012_img_train, it has 1000 folders, each folder's name represents its class id.
  2. The model definition file is mobilenetv1/models/mobilenet_v1.py, ATTENTION, K210 does not support the method of SAME PADDING in tensorflow, so we need to add padding around the image manually before a stride=2 conv (in this situation, the padding method of conv layer with stride=2 should be set to VALID
  3. Modify mobilenetv1/run_mobilenet_v1.sh and start your training.
  4. Using freeze_graph.py to freeze your model from ckpt to pb, just run python mobilenetv1/freeze_graph.py model.mobilenet_v1 ckpt_fold pb_file
  5. Test on ImageNet, you need a val dataset of ImageNet, then run python mobilenetv1/validation_imagenet.py pb_file val_set_fold
  6. Estimate one image, run python mobilenetv1/predict_one_pic.py pb_file pic

ImageNet 分类器示例

  1. 下载ImageNet数据集,按照说明解压缩训练数据集到文件夹ILSVRC2012_img_train,内含1000个子文件夹,每个子文件夹的命名为其分类代号(类似n02484975),每个子文件夹内为该分类的训练数据
  2. mobilenet v1定义文件:mobilenetv1/models/mobilenet_v1.py,需要注意由于K210不支持tensorflow的SAME padding,所以在stride=2时先固定padding一圈0,然后再进行stride=2的卷积(padding=VALID)
  3. 训练脚本 mobilenetv1/run_mobilenet_v1.sh,根据需要修改其中的参数,然后运行
  4. freeze_graph.py将训练ckpt转成pb文件,命令格式如下:
    python mobilenetv1/freeze_graph.py model.mobilenet_v1 ckpt_fold pb_file
  5. 测试在ImageNet验证集上的性能,下载验证集,将文件按类别解压好(与训练集类似),运行 python mobilenetv1/validation_imagenet.py pb_file(or ckpt folder) val_set_fold
  6. 预测单张图片,python mobilenetv1/predict_one_pic.py pb_file(or ckpt folder) pic

tensorflow-workspace's People

Contributors

bj-wanghz avatar ly0 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tensorflow-workspace's Issues

Restoring pretrained model error

It use ckpt in train_softmax.py, but use pb in run_mobilenet_v1.sh.
It case run_mobilenet_v1.sh error

  if pretrained_model:
                print('Restoring pretrained model: %s' % pretrained_model)
                saver_restore.restore(sess, tf.train.latest_checkpoint(pretrained_model))

Problem on using nncase to transfer tflite to C code

Hi,

I was following the instructions from d80f0d2#diff-7d9fc065a89438c0ca7e01e4611d0f3aR30 to generate C code from .pb file and I was using the mobilenetv1.pb file from the example. I just tried the steps from the solutions and am stuck in the following step:

.\ncc.exe -i tflite -o k210code --dataset .\dataset\ .\bin\mobilenetv1.tflite .\bin\mobilenetv1.c
It shows: Fatal: output-format.

I checked the output-format options and 'k210code' has been modified to 'k210model' since v0.1.0 RC1. So I chose 'k210model' and ran it again:
.\ncc.exe -i tflite -o k210model --dataset .\dataset\ .\bin\mobilenetv1.tflite .\bin\mobilenetv1.c
and then I got a .kmodel file rather than the .c file.

I wonder if anyone can help me with that. Thanks a lot.

TMaysGGS

Model cannot be trainned well by the scripts.

Hi, I try to use these scripts on my own datasets. I run the run_'mobilenet_v1.sh' but it cannot load pretrained model. So I train it without pretrained model. But I tried several times and found the saved model (ckpt) always output same result for different inputs. (by runing 'predict_one_pic.py ckpt_folder img') Could anybody solve my problem?

Compile mobilenet to K210

Hi,

Could you give instructions on how to use kendryte-model-compiler to compile the mobilenet checkpoint? Thanks.

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.