All Projects → VCasecnikovs → Yet Another Yolov4 Pytorch

VCasecnikovs / Yet Another Yolov4 Pytorch

Licence: mit
YOLOv4 Pytorch implementation with all freebies and specials and 15+ more exclusive improvements. Easy to use!

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Yet Another Yolov4 Pytorch

CollectionViewMultiColumnLayout
A tiled waterfal/mosaic UICollectionViewLayout with support for explicit columns.
Stars: ✭ 13 (-87.62%)
Mutual labels:  mosaic
mosaix
An iOS photo mosaic application.
Stars: ✭ 42 (-60%)
Mutual labels:  mosaic
Nem Apps Lib
Semantic Java API Library for NEM Platform
Stars: ✭ 16 (-84.76%)
Mutual labels:  mosaic
go-mosaic
相片马赛克 (Photographic mosaic)
Stars: ✭ 23 (-78.1%)
Mutual labels:  mosaic
mosaic-node-generator
Generate mosaic images in Node.
Stars: ✭ 25 (-76.19%)
Mutual labels:  mosaic
Aerial mapper
Real-time Dense Point Cloud, Digital Surface Map (DSM) and (Ortho-)Mosaic Generation for UAVs
Stars: ✭ 360 (+242.86%)
Mutual labels:  mosaic
quarkdet
QuarkDet lightweight object detection in PyTorch .Real-Time Object Detection on Mobile Devices.
Stars: ✭ 82 (-21.9%)
Mutual labels:  mosaic
Mosaic
A tiling web browser.
Stars: ✭ 74 (-29.52%)
Mutual labels:  mosaic
mosaicshapes
Transform pictures to Chuck Close inspired mosaic art.
Stars: ✭ 18 (-82.86%)
Mutual labels:  mosaic
Anime Inpainting
An application tool of edge-connect, which can do anime inpainting and drawing. 动漫人物图片自动修复,去马赛克,填补,去瑕疵
Stars: ✭ 761 (+624.76%)
Mutual labels:  mosaic
image-masaic
Set mosaic to image by canvas.
Stars: ✭ 25 (-76.19%)
Mutual labels:  mosaic
OrientedRepPoints DOTA
Oriented Object Detection: Oriented RepPoints + Swin Transformer/ReResNet
Stars: ✭ 62 (-40.95%)
Mutual labels:  mosaic
Deepmosaics
Automatically remove the mosaics in images and videos, or add mosaics to them.
Stars: ✭ 407 (+287.62%)
Mutual labels:  mosaic
BlurKit
A lightweight library that can easily blur the view.
Stars: ✭ 17 (-83.81%)
Mutual labels:  mosaic
Mosaicer
OpenCV & Tensorflow
Stars: ✭ 36 (-65.71%)
Mutual labels:  mosaic
photomosaics
Python program that makes a photo mosaic out of a given image
Stars: ✭ 25 (-76.19%)
Mutual labels:  mosaic
Mosaic
Python script for creating photomosaic images
Stars: ✭ 327 (+211.43%)
Mutual labels:  mosaic
Jquery Mosaic
A jQuery plugin to build responsive mosaics of images or any other content fitted to match heights in multiple rows while maintaining aspect ratios. http://jquery-mosaic.tin.cat
Stars: ✭ 80 (-23.81%)
Mutual labels:  mosaic
Emoji Art Generator
Use a genetic algorithm to evolve an image by putting emojies on a canvas
Stars: ✭ 53 (-49.52%)
Mutual labels:  mosaic
Complex Yolov4 Pytorch
The PyTorch Implementation based on YOLOv4 of the paper: "Complex-YOLO: Real-time 3D Object Detection on Point Clouds"
Stars: ✭ 691 (+558.1%)
Mutual labels:  mosaic

Yet-Another-YOLOv4-Pytorch

This is implementation of YOLOv4 object detection neural network on pytorch. I'll try to implement all features of original paper.

What you can already do

You can use video_demo.py to take a look at the original weights realtime OD detection. (Have 9 fps on my GTX1060 laptop!!!)

You can train your own model with mosaic augmentation for training. Guides how to do this are written below. Borders of images on some datasets are even hard to find.

You can make inference, guide bellow.

Initialize NN

#YOU CAN USE TORCH HUB
m = torch.hub.load("VCasecnikovs/Yet-Another-YOLOv4-Pytorch", "yolov4", pretrained=True)

import model
#If you change n_classes from the pretrained, there will be caught one error, don't panic it is ok

#FROM SAVED WEIGHTS
m = model.YOLOv4(n_classes=1, weights_path="weights/yolov4.pth")

#AUTOMATICALLY DOWNLOAD PRETRAINED
m = model.YOLOv4(n_classes=1, pretrained=True)

Download weights

You can use torch hub or you can download weights using from this link: https://drive.google.com/open?id=12AaR4fvIQPZ468vhm0ZYZSLgWac2HBnq

Initialize dataset

import dataset
d = dataset.ListDataset("train.txt", img_dir='images', labels_dir='labels', img_extensions=['.JPG'], train=True)
path, img, bboxes = d[0]

!!! You can use SplitDataset.ipynb to create train.txt and valid.txt

"train.txt" is file which consists with filepaths to image (images\primula\DSC02542.JPG)

img_dir - Folder with images labels_dir - Folder with txt files for annotation img_extensions - extensions if images

If you set train=False -> uses letterboxes If you set train=True -> HSV augmentations and mosaic

dataset has collate_function

# collate func example
y1 = d[0]
y2 = d[1]
paths_b, xb, yb = d.collate_fn((y1, y2))
# yb has 6 columns

Y's format

Is a tensor of size (B, 6), where B is amount of boxes in all batch images.

  1. Index of img to which this anchor belongs (if 1, then it belongs to x[1])
  2. BBox class
  3. x center
  4. y center
  5. width
  6. height

Forward with loss

y_hat, loss = m(xb, yb)

!!! y_hat is already resized anchors to image size bboxes

Forward without loss

y_hat,  _ = m(img_batch) #_ is (0, 0, 0)

Check if bboxes are correct

import utils
from PIL import Image
path, img, bboxes = d[0]
img_with_bboxes = utils.get_img_with_bboxes(img, bboxes[:, 2:]) #Returns numpy array
Image.fromarray(img_with_bboxes)

Get predicted bboxes

anchors, loss = m(xb.cuda(), yb.cuda())
confidence_threshold = 0.05
iou_threshold = 0.5
bboxes, labels = utils.get_bboxes_from_anchors(anchors, confidence_threshold, iou_threshold, coco_dict) #COCO dict is id->class dictionary (f.e. 0->person)
#For first img
arr = utils.get_img_with_bboxes(xb[0].cpu(), bboxes[0].cpu(), resize=False, labels=labels[0])
Image.fromarray(arr)

References

In case if you missed:
Paper Yolo v4: https://arxiv.org/abs/2004.10934\ Original repo: https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects

@article{yolov4,
  title={YOLOv4: YOLOv4: Optimal Speed and Accuracy of Object Detection},
  author={Alexey Bochkovskiy, Chien-Yao Wang, Hong-Yuan Mark Liao},
  journal = {arXiv},
  year={2020}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].