tensorflow-yolov4-tflite
Guides TensorFlow YOLOv3/YOLOv4 conversion, inference, training data, evaluation, TensorRT, and Android TFLite workflows for hunglc007/tensorflow-yolov4-tflite.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- tensorflow-yolov4-tflite
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Guides TensorFlow YOLOv3/YOLOv4 conversion, inference, training data, evaluation, TensorRT, and Android TFLite workflows for hunglc007/tensorflow-yolov4-tflite.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/compatibility.md4.0 KB
- 参考文档references/repo-provenance.md2.8 KB
- 参考文档references/repo-routing-metadata.json555 B
- 参考文档references/troubleshooting.md4.9 KB
- 脚本scripts/check_environment.py4.2 KB
03 SKILL.md 正文
tensorflow-yolov4-tflite
Use this repo skill when the user needs operational guidance for the
hunglc007/tensorflow-yolov4-tflite project: YOLOv3/YOLOv4 and tiny variants
implemented in TensorFlow 2, Darknet .weights conversion to SavedModel,
TFLite or TF-TRT export, image/video detection, COCO/VOC annotation preparation,
training, mAP/FPS checks, or the bundled Android TFLite demo.
First checks
- Confirm the user is working with a target checkout of this repository or a
project copied from it. The source scripts use repository-relative paths such
as
./data/classes/coco.names; run commands from the target checkout root or pass absolute paths where a flag supports them. - Read references/repo-provenance.md when checking whether this skill matches a checkout before refreshing it.
- Read references/compatibility.md before installing dependencies. The upstream pins are old: TensorFlow 2.3 era, Python 3.8 is the safest reconstruction target, modern protobuf must often be pinned below 3.20, and GPU/TensorRT needs a matching CUDA 10.x-era stack.
- Run scripts/check_environment.py against the user's target checkout for a non-destructive import/config/backend probe.
Minimal environment probe after installation:
python - <<'PY'
import tensorflow as tf, cv2
from core.config import cfg
from core import utils
print("tensorflow", tf.__version__)
print("opencv", cv2.__version__)
print("class_file", cfg.YOLO.CLASSES)
print("classes", len(utils.read_class_names(cfg.YOLO.CLASSES)))
print("gpus", tf.config.experimental.list_physical_devices("GPU"))
PY
If this fails, go to references/troubleshooting.md before changing the task plan.
Route by task
- Convert models or export formats: use
sub-skills/model-conversion/SKILL.md
for Darknet
.weightsto TensorFlow SavedModel, TFLite float32/float16/int8, TF-TRT conversion, supported flags, artifact checks, and conversion failures. - Run detection, evaluation, or benchmarks: use sub-skills/inference-evaluation/SKILL.md for image/video inference, TFLite inference, mAP file generation, FPS tests, thresholds, output files, and post-processing checks.
- Prepare data or train: use sub-skills/training-data/SKILL.md for COCO/VOC annotation formats, class/anchor config, dataset validation, training stages, freeze layers, checkpoints, and dataset-related errors.
- Use the Android demo: use sub-skills/android-deployment/SKILL.md for TFLite asset placement, Gradle/TFLite versions, YOLOv4 classifier constants, GPU/NNAPI delegate choices, and Android build/run troubleshooting.
Repo operating model
- This is a script-style repository, not an installable Python distribution.
Future agents should install the dependencies in an isolated environment and
add the target checkout root to
PYTHONPATHwhen running scripts from another working directory. core.config.cfgowns the default class file, anchors, strides, train/test annotation paths, thresholds, image size, batch size, and epoch counts.- The main Python entry points are
save_model.py,convert_tflite.py,convert_trt.py,detect.py,detectvideo.py,evaluate.py,benchmarks.py, andtrain.py. The sub-skills distill their flags and safe command-building steps; do not assume a command is safe to run until weights, datasets, output paths, and backend requirements are checked. - Full YOLOv4 weights, COCO datasets, TensorRT conversion, Android builds, and training are network-, data-, hardware-, or time-intensive. Treat them as explicit user-approved actions, not default verification steps.
Bundled helpers
- scripts/check_environment.py: safe environment and target-checkout probe shared by all workflows.
- sub-skills/model-conversion/scripts/plan_conversion.py: generates conversion command plans without running TensorFlow conversion.
- sub-skills/inference-evaluation/scripts/plan_inference.py: generates inference/evaluation/benchmark command plans and validates common option combinations.
- sub-skills/training-data/scripts/validate_annotation_line.py: validates converted COCO/VOC annotation-line syntax using tiny examples.
- sub-skills/android-deployment/scripts/check_android_assets.py: checks Android asset naming, labels, and model-file presence for a target app.
Do not use this skill when
- The user is asking about a different YOLO implementation such as Darknet, Ultralytics, MMDetection, YOLOP, or DeepStream-Yolo and does not need this repository's TensorFlow/TFLite scripts.
- The task is only generic object-detection theory, annotation labeling policy, or Android camera app development unrelated to this repo's TFLite assets.
- The user wants Creator-mode skill production or refresh work; route that to the appropriate Creator workflow instead of using this operating skill.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).