![license](https://img.shields.io/github/license/hhk7734/tensorflow-yolov4)
![pypi](https://img.shields.io/pypi/v/yolov4)
![language](https://img.shields.io/github/languages/top/hhk7734/tensorflow-yolov4)
# tensorflow-yolov4
```shell
python3 -m pip install yolov4
```
YOLOv4 Implemented in Tensorflow 2.
## Download Weights
- [yolov4-tiny.conv.29](https://drive.google.com/file/d/1WtOuGfUgNyNfALo5_VhQ1kb5QenRE0Gt/view?usp=sharing)
- [yolov4-tiny.weights](https://drive.google.com/file/d/1GJwGiR7rizY_19c_czuLN8p31BwkhWY5/view?usp=sharing)
- [yolov4.conv.137](https://drive.google.com/file/d/1li1pUtqpXj_-ZXxA8wJq-nzW8h2HWsrP/view?usp=sharing)
- [yolov4.weights](https://drive.google.com/file/d/15P4cYyZ2Sd876HKAEWSmeRdFl_j-0upi/view?usp=sharing)
## Dependencies
```shell
python3 -m pip install -U pip setuptools wheel
```
```shell
python3 -m pip install numpy
```
Install OpenCV (cv2)
### Tensorflow 2
```shell
python3 -m pip install tensorflow
```
### TFlite
Ref: [https://www.tensorflow.org/lite/guide/python](https://www.tensorflow.org/lite/guide/python)
## Objective
- [x] Train and predict using TensorFlow 2 only
- [x] Run yolov4 on Coral board(TPU).
- [ ] Update Docs
- [ ] Optimize model and operations
## Performance
![performance](./test/performance.png)
![performance-tiny](./test/performance-tiny.png)
## Help
```python
>>> from yolov4.tf import YOLOv4
>>> help(YOLOv4)
```
## Inference
### tensorflow
```python
from yolov4.tf import YOLOv4
yolo = YOLOv4()
yolo.classes = "coco.names"
yolo.make_model()
yolo.load_weights("yolov4.weights", weights_type="yolo")
yolo.inference(media_path="kite.jpg")
yolo.inference(media_path="road.mp4", is_image=False)
```
[Object detection test jupyter notebook](./test/object_detection_in_image.ipynb)
```python
from yolov4.tf import YOLOv4
yolo = YOLOv4(tiny=True)
yolo.classes = "coco.names"
yolo.make_model()
yolo.load_weights("yolov4-tiny.weights", weights_type="yolo")
yolo.inference(media_path="kite.jpg")
yolo.inference(media_path="road.mp4", is_image=False)
```
### tensorflow lite
```python
from yolov4.tf import YOLOv4
yolo = YOLOv4()
yolo.classes = "coco.names"
yolo.make_model()
yolo.load_weights("yolov4.weights", weights_type="yolo")
yolo.save_as_tflite("yolov4.tflite")
```
```python
from yolov4.tflite import YOLOv4
yolo = YOLOv4()
yolo.classes = "coco.names"
yolo.load_tflite("yolov4.tflite")
yolo.inference("kite.jpg")
```
## Training
```python
import tensorflow.keras import optimizers
from yolov4.tf import YOLOv4
yolo = YOLOv4()
yolo.classes = "coco.names"
yolo.input_size = 608
yolo.batch_size = 32
yolo.subdivision = 16
yolo.make_model()
yolo.load_weights("yolov4.conv.137", weights_type="yolo")
data_set = yolo.load_dataset("val2017.txt")
# data_set = yolo.load_dataset(
# "/home/hhk7734/darknet/data/train.txt",
# dataset_type="yolo",
# )
optimizer = optimizers.Adam(learning_rate=1e-4)
yolo.compile(optimizer=optimizer, loss_iou_type="ciou")
yolo.fit(data_set, epochs=1500)
yolo.save_weights("checkpoints")
# yolo.save_weights("yolov4.weights", weights_type="yolo")
```
[Custom training on Colab jupyter notebook](./test/custom_training_on_colab.ipynb)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共29个文件
py:17个
txt:5个
pkg-info:2个
资源分类:Python库 所属语言:Python 资源全名:yolov4-0.19.0.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
yolov4-0.19.0.tar.gz (29个子文件)
yolov4-0.19.0
MANIFEST.in 55B
PKG-INFO 14KB
CHANGELOG 7KB
setup.cfg 985B
setup.py 1KB
py_src
yolov4
model
common.py 3KB
neck.py 8KB
head.py 7KB
__init__.py 0B
yolov4.py 4KB
backbone.py 9KB
__init__.py 0B
tflite
__init__.py 7KB
common
predict.py 7KB
media.py 6KB
__init__.py 0B
base_class.py 6KB
tf
weights.py 9KB
train.py 10KB
dataset.py 10KB
__init__.py 10KB
yolov4.egg-info
PKG-INFO 14KB
requires.txt 23B
not-zip-safe 1B
SOURCES.txt 762B
top_level.txt 7B
dependency_links.txt 1B
README.md 3KB
LICENSE.txt 1KB
共 29 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功