when i run python convert.py yolov3.cfg yolov3.weights model_data/yolo.h5
i meet a problem
Using TensorFlow backend.
Loading weights.
('Weights Header: ', array([ 0, 2, 0, 32013312, 0], dtype=int32))
Parsing Darknet config.
Traceback (most recent call last):
File "convert.py", line 243, in
_main(parser.parse_args())
File "convert.py", line 75, in _main
unique_config_file = unique_config_sections(config_path)
File "convert.py", line 49, in unique_config_sections
output_stream.write(line)
TypeError: unicode argument expected, got 'str'
how should i do ?
Caused by the difference of coding between Python2 and Python3. If you are using Python2, maybe replacing io.StringIO() with io.BytesIO() works.
Hi @qqwweee ,I replaced io.StringIO() with io.BytesIO(), but got new error as follows:
Using TensorFlow backend.
Loading weights.
('Weights Header: ', array([ 0, 2, 0, 32013312, 0], dtype=int32))
Parsing Darknet config.
Traceback (most recent call last):
File "convert.py", line 237, in
_main(parser.parse_args())
File "convert.py", line 74, in _main
unique_config_file = unique_config_sections(config_path)
File "convert.py", line 48, in unique_config_sections
output_stream.write(line)
TypeError: descriptor 'write' requires a '_io.BytesIO' object but received a 'str'
@leepand I am afraid that you forgot '()' in 'output_stream=io.BytesIO()'.
@qqwweee, thanks for your quickly response,'()' was really forgotten. ha
You can see at here. I tried it and success.
https://github.com/phanxuanduc1996/convert_yolo_weights
Most helpful comment
Caused by the difference of coding between Python2 and Python3. If you are using Python2, maybe replacing io.StringIO() with io.BytesIO() works.