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

  • 相关阅读:
    mac os apache 配置方法详细介绍
    反向代理-- WEB服务的加速器[转]
    Nginx 配置基于域名的虚拟
    centos yum 安装 mongodb 以及php扩展
    优秀 Java 程序员写代码的风格,不再留坑给别人
    优秀 Java 程序员写代码的风格
    Java 必看的 Spring 知识汇总!有比这更全的算我输!
    Java Web技术经验总结
    在Java中字符串是通过引用传递的?
    15个顶级Java多线程面试题及答案
  • 原文地址:https://www.cnblogs.com/lightsong/p/10634194.html
Copyright © 2011-2022 走看看