百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
Y

yolo-tf

> 编程语言
开源

TensorFlow 实现的 YOLO(只看一次)

199 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

TensorFlow 实现的 YOLO(只看一次)

This project is deprecated. Please see yolo2-pytorch

TensorFlow implementation of the YOLO (You Only Look Once) and YOLOv2

Dependencies

  • Python 3
  • TensorFlow 1.0
  • NumPy
  • SciPy
  • Pandas
  • Matplotlib
  • BeautifulSoup4
  • OpenCV
  • PIL
  • tqdm
  • COCO (optional)

Configuration

Configurations are mainly defined in the "config.ini" file. Such as the detection model (config/model), base directory (config/basedir, which identifies the cache files (.tfrecord), the model data files (.ckpt), and summary data for TensorBoard), and the inference function ([model]/inference). Notability the configurations can be extended using the "-c" command-line argument.

Basic Usage

  • Download the PASCAL VOC 2007 (training, validation and test) and 2012 (training and validation) dataset. Extract these tars into one directory (such as "~/Documents/Database/").

  • Download the COCO 2014 (training, validation, and test) dataset. Extract these zip files into one directory (such as "~/Documents/Database/coco/").

  • Run "cache.py" to create the cache file for the training program. A verify command-line argument "-v" is strongly recommended to check the training data and drop the corrupted examples, such as the image "COCO_val2014_000000320612.jpg" in the COCO dataset.

  • Run "train.py" to start the training process (the model data saved previously will be loaded if it exists). Multiple command-line arguments can be defined to control the training process. Such as the batch size, the learning rate, the optimization algorithm and the maximum number of steps.

  • Run "detect.py" to detect objects in an image. Run "export CUDA_VISIBLE_DEVICES=" to avoid out of GPU memory error while the training process is running.

Examples

Training a 20 classes Darknet YOLOv2 model from a pretrained 80 classes model

  • Cache the 20 classes data using the customized config file argument. Cache files (.tfrecord) in "~/Documents/Database/yolo-tf/cache/20" will be created.
python3 cache.py -c config.ini config/yolo2/darknet-20.ini -v
  • Download a 80 classes Darknet YOLOv2 model (the original file name is "yolo.weights", a version from Darkflow is recommanded). In this tutorial I put it in "~/Downloads/yolo.weights".

  • Parse the 80 classes Darknet YOLOv2 model into Tensorflow format (~/Documents/Database/yolo-tf/yolo2/darknet/80/model.ckpt). A warning like "xxx bytes remaining" indicates the file "yolo.weights" is not compatiable with the original Darknet YOLOv2 model (defined in the function model.yolo2.inference.darknet). Make sure the 80 classes data is cached before parsing.

python3 parse_darknet_yolo2.py ~/Downloads/yolo.weights -c config.ini config/yolo2/darknet-80.ini -d
  • Transferring the 80 classes Darknet YOLOv2 model into a 20 classes model (~/Documents/Database/yolo-tf/yolo2/darknet/20) except the final convolutional layer. Be ware the "-d" command-line argument will delete the model files and should be used only once when initializing the model.
python3 train.py -c config.ini config/yolo2/darknet-20.ini -t ~/Documents/Database/yolo-tf/yolo2/darknet/80/model.ckpt -e yolo2_darknet/conv -d
  • Using the following command in another terminal and opening the address "localhost:6006" in a web browser to monitor the training process.
tensorboard --logdir ~/Documents/Database/yolo-tf/yolo2/darknet/20
  • If you think your model is stabilized, press Ctrl+C to cancel and restart the training with a greater batch size.
python3 train.py -c config.ini config/yolo2/darknet-20.ini -b 16
  • Detect objects from an image file.
python3 detect.py $IMAGE_FILE -c config.ini config/yolo2/darknet-20.ini
  • Detect objects with a camera.
python3 detect_camera.py -c config.ini config/yolo2/darknet-20.ini

Checklist

  • Batch normalization
  • Passthrough layer
  • Multi-scale training
  • Dimension cluster
  • Extendable configuration (via "-c" command-line argument)
  • PASCAL VOC dataset supporting
  • MS COCO dataset supporting
  • Data augmentation: random crop
  • Data augmentation: random flip horizontally
  • Multi-thread data batch queue
  • Darknet model file (.weights) parser
  • Partial model transferring before training
  • Detection from image
  • Detection from camera
  • Multi-GPU supporting
  • Faster NMS using C/C++ or GPU
  • Performance evaluation

License

This project is released as the open source software with the GNU Lesser General Public License version 3 (LGPL v3).

Acknowledgements

This project is mainly inspired by the following projects:

  • YOLO (Darknet).
  • Darkflow.

Issues· 13 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythondeep-learningobject-detectionpythontensorflow

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言