慕課網上例子,使用k-means算法分類圖片, 此處調試運行經過, 並添加包管理內容, 使得其餘同窗容易運行。html
例子地址: https://github.com/fanqingsong/cluster-imagespython
運行環境:git
python3.7github
包管理工具:web
pipenv算法
參考: https://www.cnblogs.com/wuzdandz/p/9545584.htmlwindows
運行:ide
pipenv install pipenv run ImageKmean.py
使用國內鏡像替換:工具
http://greyli.com/set-custom-pypi-mirror-url-for-pip-pipenv-poetry-and-flit/this
若是想對項目全局(per-project)設置,能夠修改 Pipfile 中 [[source]] 小節:
12345 [[source]]url = "https://pypi.doubanio.com/simple"verify_ssl = truename = "douban"
若是不用pipenv, 使用pip安裝
https://blog.csdn.net/lambert310/article/details/52412059
windows下,直接在user目錄中建立一個pip目錄,如:C:\Users\xx\pip,新建文件pip.ini,內容以下
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple
輸入爲 三張紅花 和 三張黃花
聚類輸入參數爲2類
分類結果爲 黃花一類 紅花一類
類一
類二
https://blog.csdn.net/qq_37721412/article/details/79159544
pip install Pillow
https://pillow.readthedocs.io/en/stable/handbook/overview.html
he Python Imaging Library adds image processing capabilities to your Python interpreter.
This library provides extensive file format support, an efficient internal representation, and fairly powerful image processing capabilities.
The core image library is designed for fast access to data stored in a few basic pixel formats. It should provide a solid foundation for a general image processing tool.
Let’s look at a few possible uses of this library.
https://github.com/jump1003/ImageKmeans
https://scikit-learn.org/stable/auto_examples/index.html#general-examples