Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ming71 committed Dec 16, 2019
1 parent 3d9fd86 commit e1f5f4f
Show file tree
Hide file tree
Showing 70 changed files with 85 additions and 22 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
25 changes: 20 additions & 5 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,23 @@ This tool helps you to convert json file created by labelme to COCO style for tr
* **voc2coco**
Just use it.

* **voc2yolo**
* **xml2yolo**
Yolo format: class_id + Normalized xywh (id markded from 0) for each row.
Supported xml style: **VOC**, **HRSC**(8 points & rotated)

* **ICDAR2yolo**
For challenge 4, trans polygon to rbox in yolo format.(btw, challenge1 labeled w.o rotation!)


## dataset
* **tiny_data_partition** & **data_partition**
Helpful of partition for dataset.
* **dataset_partition**
Dataset partition for train, val, test part.
**mark**: `x2` means train + val, `x3` means train + val + test.
Remember to enlarge val & test set if your dataset is tiny. (such as 6:2:2)

* **subdataset_generation**
Division of subset from total dataset, used for hyperparameter adjust.
(you can regard it as `x1` dataset_partition)

* **generate_imageset**
Generate trainval setting files.
Expand All @@ -45,9 +55,11 @@ Generate trainval setting files.
Operations on dataset , such as copy, label matching.


## data augmentation
## data augmentation
* **augmentation**
Various kinds of data augmentation implementions as well as some demos are concluded inside .
Various kinds of data augmentation implementions as well as some demos are concluded inside .
* **img_aug**
Strongly recommended! Various tools for augmentation and easy to get started.


## drawbox
Expand Down Expand Up @@ -88,3 +100,6 @@ K-means implement for box clustering.

* **skewiou**
For skewiou calc.

* **zip**
zip and unzip files.
Empty file modified SkewIou.py
100644 → 100755
Empty file.
Empty file modified converter/ccpd2voc/ccpd2voc.py
100644 → 100755
Empty file.
Empty file modified converter/labelme2COCO.py
100644 → 100755
Empty file.
Empty file modified converter/txt2voc/img_sample.bmp
100644 → 100755
Empty file.
Empty file modified converter/txt2voc/txt2voc.py
100644 → 100755
Empty file.
Empty file modified converter/txt2voc/txt2voc_v2.py
100644 → 100755
Empty file.
Empty file modified converter/txt2voc/txt_sample.txt
100644 → 100755
Empty file.
Empty file modified converter/txt2voc/voc_sample.xml
100644 → 100755
Empty file.
Empty file modified converter/voc2coco.py
100644 → 100755
Empty file.
Empty file modified converter/voc2txt/100000002.bmp
100644 → 100755
Empty file.
Empty file modified converter/voc2txt/100000002.txt
100644 → 100755
Empty file.
Empty file modified converter/voc2txt/100000002.xml
100644 → 100755
Empty file.
Empty file modified converter/voc2txt/extraction.py
100644 → 100755
Empty file.
Empty file modified converter/voc2txt/readme
100644 → 100755
Empty file.
Empty file modified crop_bbox_and_save.py
100644 → 100755
Empty file.
Empty file modified data_augmentation/affine.jpeg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data_augmentation/augmentation.py
100644 → 100755
Empty file.
Empty file modified data_augmentation/blur.jpeg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data_augmentation/flip.jpeg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data_augmentation/hsv.jpeg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data_augmentation/noise.jpeg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified data_augmentation/raw.jpeg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 12 additions & 17 deletions dataset/tiny_data_partition.py → dataset/dataset_partition_x2.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
# update: 2019.9.27
# author: ming71

# tiny dataset partition from a large one

import os
import sys
import random
import ipdb
import shutil
random.seed(66666)
# random.seed(666)


def clear_folder(path):
Expand All @@ -35,22 +33,21 @@ def division_and_copy(src_path,dst_path,indexes):
if __name__ == "__main__":

# Setting
train_ratio = 0.7 # 数据集不大时,验证集多拿一点
val_ratio = 0.3
tiny_size = 1000 # tiny数据集大小
src_imgs = r'/py/datasets/ship/ships/image'
src_labels = r'/py/datasets/ship/ships/label'
dst_train_imgs = r'/py/datasets/ship/tiny_ships/source_ships/train_imgs'
dst_train_labels = r'/py/datasets/ship/tiny_ships/source_ships/train_labels'
dst_val_imgs = r'/py/datasets/ship/tiny_ships/source_ships/val_imgs'
dst_val_labels = r'/py/datasets/ship/tiny_ships/source_ships/val_labels'
train_ratio = 0.8 # 数据集不大时,验证集测试集多拿一点
val_ratio = 0.2
src_imgs = r'/py/datasets/HRSC+/FullDataset/img'
src_labels = r'/py/datasets/HRSC+/FullDataset/label'
dst_train_imgs = r'/py/datasets/HRSC+/train'
dst_train_labels = r'/py/datasets/HRSC+/train_label'
dst_val_imgs = r'/py/datasets/HRSC+/val'
dst_val_labels = r'/py/datasets/HRSC+/val_label'

total_size = len(os.listdir(src_imgs)) # 原始数据集大小

# 生成随机index
index = random.sample([i for i in range(total_size)],tiny_size)
train_index = random.sample(index,int(tiny_size*train_ratio))
val_index = [i for i in index if i not in train_index]
index = set([i for i in range(total_size)])
train_index = set(random.sample(index,int(total_size*train_ratio)))
val_index = set(random.sample(index-train_index,int(total_size*val_ratio)))

# 清空目标文件夹
clear_folder(dst_train_imgs)
Expand All @@ -62,5 +59,3 @@ def division_and_copy(src_path,dst_path,indexes):
division_and_copy(src_imgs,dst_val_imgs,val_index)
division_and_copy(src_labels,dst_train_labels,train_index)
division_and_copy(src_labels,dst_val_labels,val_index)


File renamed without changes.
Empty file modified dataset/generate_imageset.py
100644 → 100755
Empty file.
53 changes: 53 additions & 0 deletions dataset/subdataset_generation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 为了方便所有数据集通用,以及简单起见,此处不对yolo作单独处理,默认都是img和label分离不同文件夹
# 如果是yolo,先用op_on_dataset tool将其选择性复制到不同的文件夹再划分子集


import os
import sys
import random
import ipdb
import shutil

# random.seed(666)

def clear_folder(path):
if os.listdir(path) == []:
print('{} is already clean'.format(path))
else:
files = os.listdir(path)
for file in files:
os.remove(os.path.join(path,file))



def division_and_copy(src_path,dst_path,indexes):
files= os.listdir(src_path)
files.sort() # !!!!排序,不然label就乱了
for index in indexes:
src = os.path.join(src_path,files[index])
dst = os.path.join(dst_path,files[index])
shutil.copyfile(src,dst)



if __name__ == "__main__":

# Setting
sub_ratio = 0.1
src_imgs = '/py/datasets/ICDAR2015/yolo/13+15/val_img'
src_labels = '/py/datasets/ICDAR2015/yolo/13+15/val_label'
dst_sub_imgs = '/py/datasets/ICDAR2015/yolo/subdata/val'
dst_sub_labels = '/py/datasets/ICDAR2015/yolo/subdata/val'

total_size = len(os.listdir(src_imgs)) # 原始数据集大小

# 生成随机index
index = set([i for i in range(total_size)])
sub_index = set(random.sample(index,int(total_size*sub_ratio)))

# 清空目标文件夹
clear_folder(dst_sub_imgs)
clear_folder(dst_sub_labels)

division_and_copy(src_imgs,dst_sub_imgs,sub_index)
division_and_copy(src_labels,dst_sub_labels,sub_index)
Empty file modified drawbox/README.md
100644 → 100755
Empty file.
Empty file modified drawbox/drawbox_screenshot_11.017.2019.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified drawbox/drawbox_screenshot_11.07.019.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified drawbox/drawbox_screenshot_11.07.2019.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified img_format_trans.py
100644 → 100755
Empty file.
Empty file modified kmeans.py
100644 → 100755
Empty file.
Empty file modified log_show/README.md
100644 → 100755
Empty file.
Empty file modified log_show/draw_log.py
100644 → 100755
Empty file.
Empty file modified log_show/log.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified log_show/multi-log.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified log_show/results.txt
100644 → 100755
Empty file.
Empty file modified matplotlib/4vars.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified matplotlib/Hu-hist.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified matplotlib/HuMonent.py
100644 → 100755
Empty file.
Empty file modified matplotlib/README.md
100644 → 100755
Empty file.
Empty file modified matplotlib/Superpix.py
100644 → 100755
Empty file.
Empty file modified matplotlib/board.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified matplotlib/crop_3D_8.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified matplotlib/drawing-board.py
100644 → 100755
Empty file.
Empty file modified matplotlib/matplotlib-cheatsheet.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified matplotlib/s&r_no_canny.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified matplotlib/superpix.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified python-cmd.py
100644 → 100755
Empty file.
Empty file modified readtxt.py
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/README
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/example/.~lock.price.csv#
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/example/__init__.py
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/example/books.csv
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/example/info.csv
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/example/items.py
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/example/middlewares.py
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/example/pipelines.py
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/example/price.csv
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/example/settings.py
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/example/spiders/__init__.py
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/example/spiders/book_spider.py
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/example/scrapy.cfg
100644 → 100755
Empty file.
Empty file modified spider/scapy-master/精通Scrapy网络爬虫.pdf
100644 → 100755
Empty file.
Empty file modified spider/search/kaiqian.txt
100644 → 100755
Empty file.
Empty file modified spider/search/kaiqian_result.txt
100644 → 100755
Empty file.
Empty file modified spider/spider.py
100644 → 100755
Empty file.
Empty file modified visdom-train-example.py
100644 → 100755
Empty file.

0 comments on commit e1f5f4f

Please sign in to comment.