All*_* Lu 3 python image jupyter-notebook
我有一个充满 png 图像的文件夹,我想将它们加载到我的 Jupyter 笔记本中以形成训练集。这个问题听起来很简单;但是,我找不到任何将所有 png 图像加载到 Jupyter 笔记本中并使用它们进行训练的方法。
在图像的同一文件夹中创建一个笔记本,将此代码粘贴到单元格中。然后运行它。
# collect all .png files in working dir
fs = !ls *.png
import IPython.display as dp
# create list of image objects
images = []
for ea in fs:
images.append(dp.Image(filename=ea, format='png'))
# display all images
for ea in images:
dp.display_png(ea)
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你。
| 归档时间: |
|
| 查看次数: |
9027 次 |
| 最近记录: |