zoukankan      html  css  js  c++  java
  • k-means cluster images

    说明

    慕课网上例子,使用k-means算法分类图片, 此处调试运行通过, 并添加包管理内容, 使得其他同学容易运行。

    例子地址: https://github.com/fanqingsong/cluster-images

    运行环境:

    python3.7

    包管理工具:

    pipenv

    参考: https://www.cnblogs.com/wuzdandz/p/9545584.html

    运行:

    pipenv install
    
    pipenv run ImageKmean.py

    安装运行遇到问题

    1、 安装依赖(numpy Pillow)很慢,

    使用国内镜像替换:

    http://greyli.com/set-custom-pypi-mirror-url-for-pip-pipenv-poetry-and-flit/

    如果想对项目全局(per-project)设置,可以修改 Pipfile 中 [[source]] 小节:

    1
    2
    3
    4
    5
    [[source]]
     
    url = "https://pypi.doubanio.com/simple"
    verify_ssl = true
    name = "douban"

     如果不用pipenv, 使用pip安装

    https://blog.csdn.net/lambert310/article/details/52412059

    windows下,直接在user目录中创建一个pip目录,如:C:Usersxxpip,新建文件pip.ini,内容如下

     

     [global]
     index-url = https://pypi.tuna.tsinghua.edu.cn/simple

    运行结果

    输入为 三张红花 和 三张黄花

    聚类输入参数为2类

    分类结果为 黄花一类  红花一类

    类一

     类二

    运行报错: ModuleNotFoundError: No module named 'PIL'

    https://blog.csdn.net/qq_37721412/article/details/79159544

    pip install Pillow 

    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

  • 相关阅读:
    BDOC ROUTER
    web dom api中的Selection和Range
    基于第三方vuejs库组件做适配性个性开发
    香草js侦测元素是否离开视窗viewport
    xampp windows10下xdebug调试环境安装及配置
    beyond compare全文件夹比较,仅显示变化的文件
    给定制的vuejs组件添加v-model双向绑定支持
    javascript工厂函数(factory function)vs构造函数(constructor function)
    edrawmax使用技巧备忘
    babel plugin和presets是什么,怎么用?
  • 原文地址:https://www.cnblogs.com/lightsong/p/10634194.html
Copyright © 2011-2022 走看看