Код: Выделить всё
import tkinter.filedialog
dir=tkinter.filedialog.askdirectory()
files=os.walk(dir)
for f1 in files:
direct = f1[0].split('\\')[-1]
for f in f1[2]:
if f.split('.')[-1] == 'jpeg':
import PIL.Image
jpg = f1[0] + '/' + f
img = PIL.Image.open(jpg, mode='r')
n={"image":img, "label":labels.index(direct)}
# from datasets import Image
# feature = Image()
# n['image'] = feature.encode_example(n['image'])
print(n,'\n',data_set["train"][-1])
data_set["train"].add_item(n)
{'image':
size=256x256 at 0x2585ACB0D10>, 'label': 0}
{'image':
, 'label': 18} < /p>
< /blockquote>
err: < /p>
/>pyarrow.lib.arrowinValid: не удалось преобразовать
с типом pngimagefile: не распознавал значение python
type infer and infer antferra and row row row row and /> < /blockquote>
in \ datazets \ table.py Line 757, в from_pydict < /p>
, когда не понаправдан: < /p>
from datasets import Image
feature = Image()
n['image'] = feature.encode_example(n['image'])
< /code>
print: < /p>
{'Image': {'path':
'xxxxx\00227-1230095564.jpeg',,
'bytes': none}, 'label': 0}
' />, 'label': 23} < /p>
< /blockquote>
err: < /p>
'items'
В наборах данных \ features \ features.py Line 2248 _Align_features
Подробнее здесь: https://stackoverflow.com/questions/795 ... em-dataset