tensorflow-image


Nametensorflow-image JSON
Version 1.6.0 PyPI version JSON
download
home_pagehttps://github.com/nicoyou/TensorflowImageAi
SummaryCan train and infer image-related AI
upload_time2023-03-25 11:00:03
maintainer
docs_urlNone
authornicoyou
requires_python
licenseMIT
keywords tensorflow-image tensorflow image ai nicoyou
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Tensorflow Image

### 基本的な画像関連AIの学習と推論が簡単にできるライブラリ。

このライブラリでは画像の分類、回帰、マルチラベル分類、pix2pixのディープラーニングを 2, 3 行のコードで容易に実行することができます。

学習に使用した画像数や学習履歴などの情報も保存されるため、後から確認したりグラフに表示することができます。また、続きから学習を再開することも可能です。

そのため、学習の中止と再開を何度も繰り返しても一つの連続した学習履歴として表示できます。



テストデータに対する推論結果を、正解のパラメータと比較できる図として表示することができます。



ディープラーニングで設定することのできる各パラメータは汎用的な値で最適化されています。



[![PyPI](https://img.shields.io/pypi/v/tensorflow-image)](https://pypi.org/project/tensorflow-image/)

![Python versions](https://img.shields.io/pypi/pyversions/tensorflow-image)



---



## インストール方法

```bash

pip install tensorflow-image

```





## 使用方法

"./dataset/" ディレクトリに教師データとなる画像を格納します。



分類問題ではクラスごとにディレクトリを分けて画像を格納することで、ディレクトリ名を分類の名前として認識します。





回帰問題と多ラベル分類では、各画像の情報を格納した csvファイル のパスを指定する必要があります。



それぞれの csvファイル 内構成は以下のようになります。

filename は この csvファイル からの相対パスになります。





### 回帰問題

|  filename       |  class  |

| --------------- | ------- |

|  ./image/a.png  |  0.3    |

|  ./image/b.png  |  0.6    |



### 多ラベル分類

|  filename       |  labels                   |

| --------------- | ------------------------- |

|  ./image/a.png  |  label_a,label_c,label_d  |

|  ./image/b.png  |  label_b                  |





AIをトレーニングする。

```python

import tensorflow_image as tfimg



# 画像分類

icai = tfimg.ImageClassificationAi("model_name_classification")

icai.train_model("./dataset/", epochs=6, model_type=tfimg.ModelType.efficient_net_v2_b0, trainable=True)



# 画像の回帰問題

rai = tfimg.ImageRegressionAi("model_name_regression")

rai.train_model("./dataset/data.csv", epochs=6, model_type=tfimg.ModelType.efficient_net_v2_b0, trainable=True)



# 多ラベル分類

mlai = tfimg.ImageMultiLabelAi("model_name_multilabel")

mlai.train_model("./dataset/data.csv", epochs=6, model_type=tfimg.ModelType.efficient_net_v2_b0, trainable=True)

```



学習済みモデルを読み込んで推論する。

```python

import tensorflow_image as tfimg



# 画像分類

icai = tfimg.ImageClassificationAi("model_name_classification")

icai.load_model()

result = icai.predict("./dataset/sample.png")   # 推論する

print(icai.result_to_classname(result))



# 画像の回帰問題

rai = tfimg.ImageRegressionAi("model_name_regression")

rai.load_model()

result = rai.predict("./dataset/sample.png")    # 推論する



# 多ラベル分類

mlai = tfimg.ImageMultiLabelAi("model_name_multilabel")

mlai.load_model()

result = mlai.predict("./dataset/sample.png")   # 推論する

print(mlai.result_to_label_dict(result))

print(mlai.result_to_labelname(result, 0.5))

```



---



## 対応モデル

- MobileNetV2

- VGG16

- EfficientNetV2

- ResNet-RS





ResNet-RS を使用するには以下のリポジトリを追加で pip install する必要があります

> git+https://github.com/sebastian-sz/resnet-rs-keras@main



---



## 制作者

Nicoyou



[@NicoyouSoft](https://twitter.com/NicoyouSoft)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nicoyou/TensorflowImageAi",
    "name": "tensorflow-image",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "tensorflow-image tensorflow image ai nicoyou",
    "author": "nicoyou",
    "author_email": "nicoyou.info@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c1/6e/dd3b173653860fee62ab7190d9c9c30f7b67d05cdb8850420b46d5369687/tensorflow-image-1.6.0.tar.gz",
    "platform": null,
    "description": "# Tensorflow Image\r\n\r\n### \u57fa\u672c\u7684\u306a\u753b\u50cf\u95a2\u9023AI\u306e\u5b66\u7fd2\u3068\u63a8\u8ad6\u304c\u7c21\u5358\u306b\u3067\u304d\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3002\r\n\r\n\u3053\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u306f\u753b\u50cf\u306e\u5206\u985e\u3001\u56de\u5e30\u3001\u30de\u30eb\u30c1\u30e9\u30d9\u30eb\u5206\u985e\u3001pix2pix\u306e\u30c7\u30a3\u30fc\u30d7\u30e9\u30fc\u30cb\u30f3\u30b0\u3092 2, 3 \u884c\u306e\u30b3\u30fc\u30c9\u3067\u5bb9\u6613\u306b\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\r\n\r\n\u5b66\u7fd2\u306b\u4f7f\u7528\u3057\u305f\u753b\u50cf\u6570\u3084\u5b66\u7fd2\u5c65\u6b74\u306a\u3069\u306e\u60c5\u5831\u3082\u4fdd\u5b58\u3055\u308c\u308b\u305f\u3081\u3001\u5f8c\u304b\u3089\u78ba\u8a8d\u3057\u305f\u308a\u30b0\u30e9\u30d5\u306b\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u3001\u7d9a\u304d\u304b\u3089\u5b66\u7fd2\u3092\u518d\u958b\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002\r\n\r\n\u305d\u306e\u305f\u3081\u3001\u5b66\u7fd2\u306e\u4e2d\u6b62\u3068\u518d\u958b\u3092\u4f55\u5ea6\u3082\u7e70\u308a\u8fd4\u3057\u3066\u3082\u4e00\u3064\u306e\u9023\u7d9a\u3057\u305f\u5b66\u7fd2\u5c65\u6b74\u3068\u3057\u3066\u8868\u793a\u3067\u304d\u307e\u3059\u3002\r\n\r\n\r\n\r\n\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u63a8\u8ad6\u7d50\u679c\u3092\u3001\u6b63\u89e3\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u6bd4\u8f03\u3067\u304d\u308b\u56f3\u3068\u3057\u3066\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\r\n\r\n\r\n\r\n\u30c7\u30a3\u30fc\u30d7\u30e9\u30fc\u30cb\u30f3\u30b0\u3067\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u306e\u3067\u304d\u308b\u5404\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u6c4e\u7528\u7684\u306a\u5024\u3067\u6700\u9069\u5316\u3055\u308c\u3066\u3044\u307e\u3059\u3002\r\n\r\n\r\n\r\n[![PyPI](https://img.shields.io/pypi/v/tensorflow-image)](https://pypi.org/project/tensorflow-image/)\r\n\r\n![Python versions](https://img.shields.io/pypi/pyversions/tensorflow-image)\r\n\r\n\r\n\r\n---\r\n\r\n\r\n\r\n## \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\r\n\r\n```bash\r\n\r\npip install tensorflow-image\r\n\r\n```\r\n\r\n\r\n\r\n\r\n\r\n## \u4f7f\u7528\u65b9\u6cd5\r\n\r\n\"./dataset/\" \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u6559\u5e2b\u30c7\u30fc\u30bf\u3068\u306a\u308b\u753b\u50cf\u3092\u683c\u7d0d\u3057\u307e\u3059\u3002\r\n\r\n\r\n\r\n\u5206\u985e\u554f\u984c\u3067\u306f\u30af\u30e9\u30b9\u3054\u3068\u306b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u5206\u3051\u3066\u753b\u50cf\u3092\u683c\u7d0d\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u3092\u5206\u985e\u306e\u540d\u524d\u3068\u3057\u3066\u8a8d\u8b58\u3057\u307e\u3059\u3002\r\n\r\n\r\n\r\n\r\n\r\n\u56de\u5e30\u554f\u984c\u3068\u591a\u30e9\u30d9\u30eb\u5206\u985e\u3067\u306f\u3001\u5404\u753b\u50cf\u306e\u60c5\u5831\u3092\u683c\u7d0d\u3057\u305f csv\u30d5\u30a1\u30a4\u30eb \u306e\u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\r\n\r\n\r\n\r\n\u305d\u308c\u305e\u308c\u306e csv\u30d5\u30a1\u30a4\u30eb \u5185\u69cb\u6210\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\r\n\r\nfilename \u306f \u3053\u306e csv\u30d5\u30a1\u30a4\u30eb \u304b\u3089\u306e\u76f8\u5bfe\u30d1\u30b9\u306b\u306a\u308a\u307e\u3059\u3002\r\n\r\n\r\n\r\n\r\n\r\n### \u56de\u5e30\u554f\u984c\r\n\r\n|  filename       |  class  |\r\n\r\n| --------------- | ------- |\r\n\r\n|  ./image/a.png  |  0.3    |\r\n\r\n|  ./image/b.png  |  0.6    |\r\n\r\n\r\n\r\n### \u591a\u30e9\u30d9\u30eb\u5206\u985e\r\n\r\n|  filename       |  labels                   |\r\n\r\n| --------------- | ------------------------- |\r\n\r\n|  ./image/a.png  |  label_a,label_c,label_d  |\r\n\r\n|  ./image/b.png  |  label_b                  |\r\n\r\n\r\n\r\n\r\n\r\nAI\u3092\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u3059\u308b\u3002\r\n\r\n```python\r\n\r\nimport tensorflow_image as tfimg\r\n\r\n\r\n\r\n# \u753b\u50cf\u5206\u985e\r\n\r\nicai = tfimg.ImageClassificationAi(\"model_name_classification\")\r\n\r\nicai.train_model(\"./dataset/\", epochs=6, model_type=tfimg.ModelType.efficient_net_v2_b0, trainable=True)\r\n\r\n\r\n\r\n# \u753b\u50cf\u306e\u56de\u5e30\u554f\u984c\r\n\r\nrai = tfimg.ImageRegressionAi(\"model_name_regression\")\r\n\r\nrai.train_model(\"./dataset/data.csv\", epochs=6, model_type=tfimg.ModelType.efficient_net_v2_b0, trainable=True)\r\n\r\n\r\n\r\n# \u591a\u30e9\u30d9\u30eb\u5206\u985e\r\n\r\nmlai = tfimg.ImageMultiLabelAi(\"model_name_multilabel\")\r\n\r\nmlai.train_model(\"./dataset/data.csv\", epochs=6, model_type=tfimg.ModelType.efficient_net_v2_b0, trainable=True)\r\n\r\n```\r\n\r\n\r\n\r\n\u5b66\u7fd2\u6e08\u307f\u30e2\u30c7\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3067\u63a8\u8ad6\u3059\u308b\u3002\r\n\r\n```python\r\n\r\nimport tensorflow_image as tfimg\r\n\r\n\r\n\r\n# \u753b\u50cf\u5206\u985e\r\n\r\nicai = tfimg.ImageClassificationAi(\"model_name_classification\")\r\n\r\nicai.load_model()\r\n\r\nresult = icai.predict(\"./dataset/sample.png\")   # \u63a8\u8ad6\u3059\u308b\r\n\r\nprint(icai.result_to_classname(result))\r\n\r\n\r\n\r\n# \u753b\u50cf\u306e\u56de\u5e30\u554f\u984c\r\n\r\nrai = tfimg.ImageRegressionAi(\"model_name_regression\")\r\n\r\nrai.load_model()\r\n\r\nresult = rai.predict(\"./dataset/sample.png\")    # \u63a8\u8ad6\u3059\u308b\r\n\r\n\r\n\r\n# \u591a\u30e9\u30d9\u30eb\u5206\u985e\r\n\r\nmlai = tfimg.ImageMultiLabelAi(\"model_name_multilabel\")\r\n\r\nmlai.load_model()\r\n\r\nresult = mlai.predict(\"./dataset/sample.png\")   # \u63a8\u8ad6\u3059\u308b\r\n\r\nprint(mlai.result_to_label_dict(result))\r\n\r\nprint(mlai.result_to_labelname(result, 0.5))\r\n\r\n```\r\n\r\n\r\n\r\n---\r\n\r\n\r\n\r\n## \u5bfe\u5fdc\u30e2\u30c7\u30eb\r\n\r\n- MobileNetV2\r\n\r\n- VGG16\r\n\r\n- EfficientNetV2\r\n\r\n- ResNet-RS\r\n\r\n\r\n\r\n\r\n\r\nResNet-RS \u3092\u4f7f\u7528\u3059\u308b\u306b\u306f\u4ee5\u4e0b\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u8ffd\u52a0\u3067 pip install \u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\r\n\r\n> git+https://github.com/sebastian-sz/resnet-rs-keras@main\r\n\r\n\r\n\r\n---\r\n\r\n\r\n\r\n## \u5236\u4f5c\u8005\r\n\r\nNicoyou\r\n\r\n\r\n\r\n[@NicoyouSoft](https://twitter.com/NicoyouSoft)\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Can train and infer image-related AI",
    "version": "1.6.0",
    "split_keywords": [
        "tensorflow-image",
        "tensorflow",
        "image",
        "ai",
        "nicoyou"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "45f36b857647ea3b58d79f0c33cd671a076c95d5800a98931c72df7b52dfdf32",
                "md5": "ba778e5d7d9c5cb3a2b745a8464982c5",
                "sha256": "981b8f4e4ef22278ba0b1640baf731ff8060e8519afa96bbcb3e183e4f44b8d3"
            },
            "downloads": -1,
            "filename": "tensorflow_image-1.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ba778e5d7d9c5cb3a2b745a8464982c5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 32420,
            "upload_time": "2023-03-25T11:00:02",
            "upload_time_iso_8601": "2023-03-25T11:00:02.225027Z",
            "url": "https://files.pythonhosted.org/packages/45/f3/6b857647ea3b58d79f0c33cd671a076c95d5800a98931c72df7b52dfdf32/tensorflow_image-1.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c16edd3b173653860fee62ab7190d9c9c30f7b67d05cdb8850420b46d5369687",
                "md5": "f7ee504d1e291cbfa8b1ee3306d15eb4",
                "sha256": "e58b380e3962c458bed9c074d265eec4dc889b3f8143b9e981f4599254e59c19"
            },
            "downloads": -1,
            "filename": "tensorflow-image-1.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f7ee504d1e291cbfa8b1ee3306d15eb4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 24399,
            "upload_time": "2023-03-25T11:00:03",
            "upload_time_iso_8601": "2023-03-25T11:00:03.986106Z",
            "url": "https://files.pythonhosted.org/packages/c1/6e/dd3b173653860fee62ab7190d9c9c30f7b67d05cdb8850420b46d5369687/tensorflow-image-1.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-25 11:00:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "nicoyou",
    "github_project": "TensorflowImageAi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "tensorflow-image"
}
        
Elapsed time: 0.05634s