AIWintermuteAI / aXeleRate

Keras-based framework for AI on the Edge
MIT License
177 stars 71 forks source link

feat&fix(yolo): yolov3 k210 run-through #54

Closed yangtuo250 closed 3 years ago

yangtuo250 commented 3 years ago
  1. fix convert error
  2. quantize training and validation frequency can be configured by config.json

    53 #52 #51

AIWintermuteAI commented 3 years ago

Hi there! Thanks for the PR. I quickly looked through it, some of the changes make a lot of sense - for example, big thanks for a hint about setting tensor shape before tflite conversion. That indeed should resolve SHAPE op problem. Now, unstable branch wasn't meant for other people to use - it was just intermediary branch, which I used for QAT and pruning experiments. That's why the training goes straight to QAT (https://github.com/AIWintermuteAI/aXeleRate/issues/52). If I do implement QAT/pruning fine-tuning it's going to be a separate file in axelerate folder, similar to evaluate/train/infer. PR also has a lot style changes - some of them are great, for example having global static veriables in convert.py in capital letters. Others are a bit more questionable, for example I think that

model_layers, model_path = classifier.train(config['train']['train_image_folder'],
                                       config['train']['actual_epoch'],
                                       project_folder,
                                       config["train"]["batch_size"],
                                       config["train"]["augmentation"],
                                       config['train']['learning_rate'], 
                                       config['train']['train_times'],
                                       config['train']['valid_times'],
                                       config['train']['valid_image_folder'],
                                       config['train']['first_trainable_layer'],
                                       config['train']['valid_metric'])

is more readable than

model_layers, model_path = classifier.train(config['train']['train_image_folder'], config['train']['actual_epoch'],
                                            project_folder, config["train"]["batch_size"],
                                            config["train"]["augmentation"], config['train']['learning_rate'],
                                            config['train']['train_times'], config['train']['valid_times'],
                                            config['train']['valid_image_folder'],
                                            config['train']['first_trainable_layer'], config['train']['valid_metric'])

Since I won't be merging unstable branch directly to master or dev, I'll accept the PR and make some changes to it.

yangtuo250 commented 3 years ago

Thanks for so fast replying and merging! I'll only reply here for not reopen closed issues(#51 #52 #53 ) and for your reading convenience. Your great job helps me a lot. I am working on Kendryte K210 related image classification and object detection tasks and your aXeleRate is the most easy-used K210 model generating tool among all open sourced projects. Sorry for my inexperience on edge TPU or other edge AI accelerators, so I cannot verify my changes on other platforms except for K210(my code may bring unexpected errors on model for those platforms).

Others are a bit more questionable, for example I think that model_layers, model_path = classifier.train(config['train']['train_image_folder'], config['train']['actual_epoch'], project_folder, config["train"]["batch_size"], config["train"]["augmentation"], config['train']['learning_rate'], config['train']['train_times'], config['train']['valid_times'], config['train']['valid_image_folder'], config['train']['first_trainable_layer'], config['train']['valid_metric']) is more readable than model_layers, model_path = classifier.train(config['train']['train_image_folder'], config['train']['actual_epoch'], project_folder, config["train"]["batch_size"], config["train"]["augmentation"], config['train']['learning_rate'], config['train']['train_times'], config['train']['valid_times'], config['train']['valid_image_folder'], config['train']['first_trainable_layer'], config['train']['valid_metric'])

Apologize for my poor usage of yapf formatting tools and trouble making for you changing the style again. And I won't agree more about your coding style, so I will change the tool and coding style in future PRs.

Now, unstable branch wasn't meant for other people to use - it was just intermediary branch, which I used for QAT and pruning experiments. That's why the training goes straight to QAT (#52). If I do implement QAT/pruning fine-tuning it's going to be a separate file in axelerate folder, similar to evaluate/train/infer.

I found surprisingly your new branch unstable support YOLOv3 (with MobileNet backbone) training and that's exactly what I want to add to aXeleRate. Thanks for your great effort again! I knew it's not for other people to use(from your branch name "unstable"), but I cannot wait to use it for those new features related to YOLOv3 on K210. I would like to propose more PRs on YOLO K210 training on this branch as I‘m working on it. So if any of my modification bothering you or better way for my code contribution, please free to let me know. Thank you!