GithubHelp home page GithubHelp logo

emilhovad / bane Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 441.18 MB

Analysis of rail images and track recording car

Python 16.81% Jupyter Notebook 33.28% Shell 0.47% CSS 0.04% HTML 0.10% JavaScript 3.16% MATLAB 0.94% Makefile 0.14% C# 0.09% PowerShell 0.01% Batchfile 0.23% C 37.13% Cuda 5.30% C++ 2.28% Objective-C 0.02%

bane's Introduction

bane

Analysis of rail images and track recording car.

#######

Tensorflow_yolov3 (folder name)

First the original repo is from https://github.com/YunYang1994/tensorflow-yolov3

NOTE, we choosed the folder name /tensorflow_yolov3 instead of /tensorflow-yolov3 (might be problematic)

If you want to train an example of a simple 1-class data set, a raccoon data set is provided and explained in the readme.md or look in the original repo...

#######

a) Here it is for training the banedk images,

Train "train image" dataset

To help you understand my training process, I made this training-pipline. The train dataset has three classes with alot of images,

  1. First you need to convert the original yolo label (many txt files in the folder /yolo_label/) to the labelling used in this tensorflow-yolov3 framework (1 txt file in the folder /tf_yolo_label/), remember to change the folders to where your images and yolo labelling are

$ Change_Labelling.py This will put the new labelling (1 txt file) for this framework into the folder /tf_yolo_label/ This txt file will be in the format of, #image_path x_min y_min x_max y_max class_id x_min y_min ... class_id xxx/xxx.jpg 18.19 6.32 424.13 421.83 20 323.86 2.65 640.0 421.94 20 xxx/xxx.jpg 55.38 132.63 519.84 380.4 16

  1. Then a shell script is prepared in the ./scripts which enables you to get data and train it ! how to train it ?

$ sh scripts/make_bane.sh # check folders in the bash script, but it should be ok. It should give you the output "Saving 1236 images in ./tf_yolo_label/bane_test.tfrecords", which means that two files are created a) bane_test.tfrecords and b) bane_train.tfrecords

  1. Check the labelling in the tfrecords format

$ python show_input_image_bane.py # show your input image (optional)

  1. Make a anchor file anchor.txt and put in the /data/ folder based on his readme.md file (train your own data)

$ python kmeans_bane.py # get prior anchors and rescale the values to the range [0,1]

  1. Get the pretrained weights (downloads automatically if no files are in /checkpoint/) this is probably where you can choose (320X320, 416X1416 or 608X608) in the url download or if you put the weights in the /checkpoint/ folder

$ python convert_weight_tf_bane.py --convert # get pretrained weights Remember our files are black white, we will convert the images to rgb and use three channels

  1. Train your network, see in the top of the python file for the settings and make settings for our pc/cluster (it is somewhat intuitive)

$ python quick_train_bane.py

$ tensorboard --logdir ./data

As you can see in the tensorboard, if your dataset is too small or you train for too long, the model starts to overfit and learn patterns from training data that does not generalize to the test data. how to test and evaluate it ?

  1. Depending on what "if (epoch+1) % 800 == 0: saver.save(sess, save_path="./checkpoint/yolov3.ckpt", global_step=epoch+1))" saves with a multiplum of modulus = 800, this can be converted to a pb file which is what is used in tf

$ python convert_weight_tf_bane.py -cf ./checkpoint/yolov3.ckpt-800 -nc 3 -ap ./data/anchors.txt --freeze

Creates a './checkpoint/yolov3_cpu_nms.pb' file and a './checkpoint/yolov3_gpu_nms.pb' file.

  1. Test the pb files (cpu and/or gpu), in this case it is 608X608X3 (3 color channels!)

$ python quick_test_bane_tf_trained.py

  1. Todo get the evaluation code to work with our three class example, it works for the racoon example! $ python evaluate_bane.py

#######

b) Convert weight trained in the pjreddie framework to the tensorflow-yolov3 framework,

  1. use the code to convert the pjreddie trained network (darknet) to the this framework, this code convert the network with only 1 colour channel

$python convert_weight_darknet_Thomas.py --convert

=> model saved in path: ./checkpoint/yolov3darknet.ckpt (you should get this output)

  1. convert yolov3darknet.ckpt to pb files when testing remember this network is 608X608X1 (1 color channel!)

#python convert_weight_darknet_Thomas.py -cf ./checkpoint/yolov3darknet.ckpt -nc 3 -ap ./data/anchors.txt --freeze

=> 1354 ops written to ./checkpoint/yolov3bane_cpu_nms.pb. => 1607 ops written to ./checkpoint/yolov3bane_gpu_nms.pb. (you should get this output)

  1. Test the pb files (cpu and/or gpu), in this case it is 608X608X1 (1 color channels!)

#quick_test_bane.py (get a picture with a prediction)

#######

Auto_detection_rail_failures_images (folder name)

This is based on Helena's bsc project, here straight rails are investigated

bane's People

Contributors

emilhovad avatar wado88 avatar

Watchers

James Cloos avatar  avatar

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.