すべてのプロダクト
Search
ドキュメントセンター

Platform For AI:概要

最終更新日:Jul 22, 2024

既存のファイルをTFRecordファイルに変換するには、まずMachine Learning Platform for AI (PAI) を使用してファイルをラベル付きデータセットに変換する必要があります。 次に、ラベル付きデータセットをTFRecordファイルに変換できます。 このトピックでは、シングルラベル画像分類、マルチラベル画像分類、オブジェクト検出、画像セグメンテーション、テキスト認識、およびテキスト検出のためのラベル付きデータセットのエントリの形式について説明します。

ラベル付きデータを含むCSVファイルの要素を次の表に示します。

要素

データ型

説明

エントリID

INT

エントリのID。

生データ

JSON

ソースイメージのURL。

ラベリング結果

JSON

ラベリング結果。

シングルラベル画像分類

# The entry ID, raw data, and labeling result.
1,{"url":"http://a.jpg"},"{"option":"Passport"}
2,{"url":"http://b.jpg"},"{"option":"Passport"}

ラベリング結果には、次の情報が含まれます。

{
    "option":"Passport"    # The label of the image.
}

マルチラベル画像分類

# The entry ID, raw data, and labeling result.
1,{"url":"http://a.jpg"},{["option":"Passport", "option":"ID card"]}
2,{"url":"http://b.jpg"},{["option":"Passport", "option":"Exit-Entry Permit for Traveling to and from Hong Kong and Macau"]}

ラベリング結果には、次の情報が含まれます。

{
    "option":["Passport", "ID card"]    # The labels of the image.
}

オブジェクト検出

# The entry ID, raw data, and labeling result.
1,{"url": "http://b.jpg"},[{"text": "{\"class*\": \"Category 1\"}", "coord": ["306.73", "517.59", "324.42", "282.07", "347.69", "282.07", "333.73", "519.45"]}, {"text": "{\"class*\": \"Category 2\"}", "coord": ["342.11", "723.32", "349.56", "608.81", "366.31", "606.95", "360.73", "730.76"]}]
2,{"url": "http://a.jpg"},[{"text": "{\"class*\": \"Category 1\"}", "coord": ["338.35", "8.53", "700.16", "8.53", "700.16", "50.35", "338.35", "50.35"]}, {"text": "{\"class*\": \"Category 2\"}", "coord": ["26.88", "64.00", "218.03", "64.00", "218.03", "99.84", "26.88", "99.84"]}]"

ラベリング結果には、次の情報が含まれます。

[        # The list of objects.
    {
        "text":"{\"class*\": \"Category 1\"}",    # The JSON string that indicates the category to which the object belongs.
        "coord":[    # The coordinates that identify the location of the bounding box drawn around the object.
            "338.35",
            "8.53",
            "700.16",
            "8.53",
            "700.16",
            "50.35",
            "338.35",
            "50.35"
        ]
    },
    {
        "text":"{\"class*\": \Category 2\"}",
        "coord":[
            "26.88",
            "64.00",
            "218.03",
            "64.00",
            "218.03",
            "99.84",
            "26.88",
            "99.84"
        ]
    }
]

画像セグメンテーション

サンプルCSVファイルをダウンロードします。

# The entry ID, raw data, and labeling result.
1,{"http://a.jpg"},{"ossUrl":"http://ossgw.alicdn.com/a.png"}

ラベリング結果には、次の情報が含まれます。

{
    "ossUrl":"http://ossgw.alicdn.com/a.png"
    # The Object Storage Service (OSS) URL of the mask generated for the image. The mask is in PNG format. An image has red, blue, and green channels for storing information. The red channel usually stores category information of the image.
    # The ID of the channel starts from 0. Valid values: 0 to 3. The value of 0 indicates the background.
}

テキスト認識

# The entry ID, raw data, and labeling result.
1,{"url": "http://b.jpg"},{"text": "Text 1"}
2,{"url": "http://a.jpg"},{"text": "Text 2"}

ラベリング結果には、次の情報が含まれます。

{
    "text":"Text 1"# The recognized text.
}

テキスト検出

# The entry ID, raw data, and labeling result.
1,{"url": "http://b.jpg"},[[{"text": "{\"direction\": \"Bottom right\", \"class*\": \"Category 1\"}", "coord": ["306.73", "517.59", "324.42", "282.07", "347.69", "282.07", "333.73", "519.45"]}, {"text": "{\"direction\": \"Bottom right\", \"class*\": \"Category 2\"}", "coord": ["342.11", "723.32", "349.56", "608.81", "366.31", "606.95", "360.73", "730.76"]}], {"option": "Bottom right"}]
2,{"url": "http://a.jpg"},[[{"text": "{\"direction\": \"Bottom down\", \"class*\": \"Category 1\"}", "coord": ["338.35", "8.53", "700.16", "8.53", "700.16", "50.35", "338.35", "50.35"]}, {"text": "{\"direction\": \"Bottom down\", \"class*\": \"Category 2\"}", "coord": ["26.88", "64.00", "218.03", "64.00", "218.03", "99.84", "26.88", "99.84"]}], {"option": "Bottom down"}]

ラベリング結果には、次の情報が含まれます。

[        # The list of text lines.
    [
        {
            "text":"{\"direction\": \"Bottom down\", \"class*\": \"Category 1\"}",
                         # The JSON string that indicates the information about the text line. The direction field indicates the orientation of the text line, whereas the class* field indicates the category of the text.
            "coord":[ # The coordinates that identify the location of the bounding box drawn around the text line.
                "338.35",
                "8.53",
                "700.16",
                "8.53",
                "700.16",
                "50.35",
                "338.35",
                "50.35"
            ]
        },
        {
            "text":"{\"direction\": \"Bottom down\", \"class*\": \"Category 2\"}",
            "coord":[
                "26.88",
                "64.00",
                "218.03",
                "64.00",
                "218.03",
                "99.84",
                "26.88",
                "99.84"
            ]
        }
    ],
    {
        "option":"Bottom down"    # The orientation of the image.
    }
]

画像の向きは、画像の下部が下向き、上向き、左向き、または右向きのいずれであるかを指定します。

エンドツーエンドのテキスト認識

# The entry ID, raw data, and labeling result.
1,{"url": "http://b.jpg"},[[{"text": "{\"text\": \"Text 1\", \"direction\": \"Bottom right\", \"class*\": \"Category 1\"}", "coord": ["306.73", "517.59", "324.42", "282.07", "347.69", "282.07", "333.73", "519.45"]}, {"text": "{\"text\": \"Text 2\", \"direction\": \"Bottom right\", \"class*\": \"Category 2\"}", "coord": ["342.11", "723.32", "349.56", "608.81", "366.31", "606.95", "360.73", "730.76"]}], {"option": "Bottom right"}]
2,{"url": "http://a.jpg"},[[{"text": "{\"text\": \"Text 3\", \"direction\": \"Bottom down\", \"class*\": \"Category 1\"}", "coord": ["338.35", "8.53", "700.16", "8.53", "700.16", "50.35", "338.35", "50.35"]}, {"text": "{\"text\": \"Text 4\", \"direction\": \"Bottom down\", \"class*\": \"Category 2\"}", "coord": ["26.88", "64.00", "218.03", "64.00", "218.03", "99.84", "26.88", "99.84"]}], {"option": "Bottom down"}]

ラベリング結果には、次の情報が含まれます。

[        # The list of text lines.
    [
        {
            "text":"{\"text\": \"Text 3\", "\"direction\": \"Bottom down\", \"class*\": \"Category 1\"}",
                         # The JSON string that indicates the information about the text line. The direction field indicates the orientation of the text line, whereas the class* field indicates the category of the text.                         
            "coord":[ # The coordinates that identify the location of the bounding box drawn around the text line.
                "338.35",
                "8.53",
                "700.16",
                "8.53",
                "700.16",
                "50.35",
                "338.35",
                "50.35"
            ]
        },
        {
            "text":"{\"text\": \"Text 4\", \"direction\": \"Bottom down\", \"class*\": \"Category 2\"}",
            "coord":[
                "26.88",
                "64.00",
                "218.03",
                "64.00",
                "218.03",
                "99.84",
                "26.88",
                "99.84"
            ]
        }
    ],
    {
        "option":"Bottom down"    # The orientation of the image.
    }
]

画像の向きは、画像の下部が下向き、上向き、左向き、または右向きのいずれであるかを指定します。