UnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 10: invalid continuation byte COCO json

coco = COCO("/root/.keras/datasets/instances_train.json")

Код ошибки:

loading annotations into memory...
---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-30-8d1ab4328f18> in <module>()
      1 
----> 2 coco = COCO("/root/.keras/datasets/instances_train.json")

2 frames
/usr/lib/python3.7/codecs.py in decode(self, input, final)
    320         # decode input (taking the buffer into account)
    321         data = self.buffer + input
--> 322         (result, consumed) = self._buffer_decode(data, self.errors, final)
    323         # keep undecoded input until the next call
    324         self.buffer = data[consumed:]

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xee in position 10: invalid continuation byte

Ответы (1 шт):

Автор решения: CrazyElf

Скорее всего у вас входной файл /root/.keras/datasets/instances_train.json не в той кодировке. Убедитесь, что он записан именно в кодировке UTF-8. Ну, либо он просто повреждён.

→ Ссылка