Spaces:
Runtime error
Runtime error
Niv Sardi
commited on
Commit
·
94a3eb0
1
Parent(s):
eab1d0a
write_data.py: add --data arg
Browse filesSigned-off-by: Niv Sardi <[email protected]>
- python/write_data.py +8 -4
python/write_data.py
CHANGED
@@ -4,11 +4,13 @@ import argparse
|
|
4 |
|
5 |
from common import defaults
|
6 |
|
7 |
-
def gen_data_yaml(bcos):
|
8 |
names = [f"{d['name']}" for d in bcos.values()]
|
9 |
return f'''
|
10 |
-
|
11 |
-
|
|
|
|
|
12 |
|
13 |
nc: {len(bcos.keys())}
|
14 |
names: [{names}]
|
@@ -18,6 +20,8 @@ if __name__ == '__main__':
|
|
18 |
parser = argparse.ArgumentParser(description='creates a YOLOv5 data.yaml')
|
19 |
parser.add_argument('csv', metavar='csv', type=str,
|
20 |
help='csv file')
|
|
|
|
|
21 |
args = parser.parse_args()
|
22 |
bcos = entity.read_entities(args.csv)
|
23 |
-
print(gen_data_yaml(bcos))
|
|
|
4 |
|
5 |
from common import defaults
|
6 |
|
7 |
+
def gen_data_yaml(bcos, datapath='../data'):
|
8 |
names = [f"{d['name']}" for d in bcos.values()]
|
9 |
return f'''
|
10 |
+
# this file is autogenerated by write_data.py
|
11 |
+
|
12 |
+
train: {datapath}/squares
|
13 |
+
val: {datapath}/squares
|
14 |
|
15 |
nc: {len(bcos.keys())}
|
16 |
names: [{names}]
|
|
|
20 |
parser = argparse.ArgumentParser(description='creates a YOLOv5 data.yaml')
|
21 |
parser.add_argument('csv', metavar='csv', type=str,
|
22 |
help='csv file')
|
23 |
+
parser.add_argument('--data', metavar='data', type=str,
|
24 |
+
help='data path', default='../data')
|
25 |
args = parser.parse_args()
|
26 |
bcos = entity.read_entities(args.csv)
|
27 |
+
print(gen_data_yaml(bcos, args.data))
|