I faced an error while running YOLOv5 on Google Colab. I think the issue is with the content of the data.yaml
file (attached below), and despite trying various concepts, it's still not working. How can I resolve this?
!python /content/yolov5/train.py --batch 70 --epochs 30 --data "/content/elec_meter_yaml/data.yaml" --cfg /content/yolov5/models/yolov5x.yaml --weights yolov5x.pt --name runs
Error
Traceback (most recent call last):
File "/content/yolov5/train.py", line 640, in <module>
main(opt)
File "/content/yolov5/train.py", line 529, in main
train(opt.hyp, opt, device, callbacks)
File "/content/yolov5/train.py", line 112, in train
data_dict = data_dict or check_dataset(data) # check if None
File "/content/yolov5/utils/general.py", line 518, in check_dataset
data = yaml_load(data) # dictionary
File "/content/yolov5/utils/general.py", line 603, in yaml_load
return yaml.safe_load(f)
File "/usr/local/lib/python3.8/dist-packages/yaml/__init__.py", line 125, in safe_load
return load(stream, SafeLoader)
File "/usr/local/lib/python3.8/dist-packages/yaml/__init__.py", line 81, in load
return loader.get_single_data()
File "/usr/local/lib/python3.8/dist-packages/yaml/constructor.py", line 49, in get_single_data
node = self.get_single_node()
File "/usr/local/lib/python3.8/dist-packages/yaml/composer.py", line 36, in get_single_node
document = self.compose_document()
File "/usr/local/lib/python3.8/dist-packages/yaml/composer.py", line 58, in compose_document
self.get_event()
File "/usr/local/lib/python3.8/dist-packages/yaml/parser.py", line 118, in get_event
self.current_event = self.state()
File "/usr/local/lib/python3.8/dist-packages/yaml/parser.py", line 193, in parse_document_end
token = self.peek_token()
File "/usr/local/lib/python3.8/dist-packages/yaml/scanner.py", line 129, in peek_token
self.fetch_more_tokens()
File "/usr/local/lib/python3.8/dist-packages/yaml/scanner.py", line 223, in fetch_more_tokens
return self.fetch_value()
File "/usr/local/lib/python3.8/dist-packages/yaml/scanner.py", line 577, in fetch_value
raise ScannerError(None, None,
yaml.scanner.ScannerError: mapping values are not allowed here
in "/content/elec_meter_yaml/data.yaml", line 6, column 6
data.yaml
train = '/content/elec_meter_yaml/train.txt'
val = '/content/elec_meter_yaml/val.txt'
test = '/content/elec_meter_yaml/test.txt'
nc = 12
names:
0: one
1: two
2: three
3: four
4: five
5: six
6: seven
7: eight
8: nine
9: zero
10: meter
11: dot