CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hukaixuan19970627

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: hukaixuan19970627/yolov5_obb
Path: blob/master/DOTA_devkit/prepare_hrsc2016.py
Views: 475
1
import os
2
import os.path as osp
3
from DOTA_devkit.HRSC2DOTA import generate_txt_labels
4
from DOTA_devkit.DOTA2JSON import generate_json_labels
5
6
def preprare_hrsc2016(data_dir):
7
train_dir = osp.join(data_dir,'Train')
8
test_dir = osp.join(data_dir, 'Test')
9
# convert hrsc2016 to dota raw format
10
generate_txt_labels(train_dir)
11
generate_txt_labels(test_dir)
12
# convert it to json format
13
generate_json_labels(train_dir,osp.join(train_dir,'trainval.json'))
14
generate_json_labels(test_dir,osp.join(test_dir,'test.json'), trainval=False)
15
16
if __name__ == '__main__':
17
hrsc2016_dir = '/mnt/SSD/lwt_workdir/BeyondBoundingBox/data/hrsc2016/'
18
preprare_hrsc2016(hrsc2016_dir)
19
print('done')
20
21