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

  • 相关阅读:
    分享几个python小脚本
    关于python编译的一点小结
    一位测试工程师工作一年的心得体会
    Zookeeper知识梳理
    Kafka知识梳理(转载)
    霍夫曼编码压缩算法(转载 -- www.uusystem.com)
    表、栈和队列
    Python3正则表达式清洗Excel文档
    MongoDB学习笔记
    Centos--Docker应用
  • 原文地址:https://www.cnblogs.com/lightsong/p/10634194.html
Copyright © 2011-2022 走看看