0

我想用我的数据进行图像分割训练。

我使用 labelImg 获得了图像的 json 文件。

我想使用 json 文件获取图像的掩码。

有没有办法将 json 文件转换为图像格式(.jpg、.png)?

另外,是否有与使用 keras 进行图像分割相关的示例?

json 文件如下所示:

{
  "version": "4.5.7",
  "flags": {},
  "shapes": [
    {
      "label": "melt pool",
      "points": [
        [
          102.56882255389718,
          134.1625207296849
        ],
        [
          99.74958540630182,
          131.67495854063017
        ],
        [
          97.75953565505804,
          129.35323383084577
        ],
        [
          96.2669983416252,
          124.54394693200663
        ],
        [
          96.10116086235489,
          120.23217247097844
        ],
        [
          95.76948590381426,
          115.25704809286898
        ],
        [
          96.43283582089552,
          107.7943615257048
        ],
        [
          98.92039800995025,
          103.15091210613598
        ],
        [
          101.40796019900498,
          99.33665008291874
        ],
        [
          104.22719734660032,
          96.51741293532338
        ],
        [
          107.87562189054727,
          94.69320066334991
        ],
        [
          113.01658374792703,
          93.69817578772802
        ],
        [
          117.32835820895522,
          94.5273631840796
        ],
        [
          120.97678275290215,
          97.18076285240464
        ],
        [
          124.12769485903814,
          99.83416252072968
        ],
        [
          127.27860696517413,
          103.64842454394693
        ],
        [
          129.60033167495854,
          109.28689883913763
        ],
        [
          129.60033167495854,
          114.92537313432835
        ],
        [
          128.93698175787728,
          121.06135986733001
        ],
        [
          126.61525704809287,
          127.19734660033167
        ],
        [
          121.97180762852403,
          131.17744610281923
        ],
        [
          117.82587064676616,
          133.83084577114428
        ],
        [
          112.18739635157544,
          134.82587064676616
        ],
        [
          107.54394693200663,
          135.15754560530678
        ]
      ],
      "group_id": 1,
      "shape_type": "polygon",
      "flags": {}
    },
    {
      "label": "spatter",
      "points": [
        [
          80.8441127694859,
          124.04643449419568
        ],
        [
          75.86898839137645,
          123.38308457711442
        ],
        [
          74.04477611940298,
          120.39800995024875
        ],
        [
          74.21061359867329,
          116.58374792703151
        ],
        [
          75.53731343283582,
          112.43781094527363
        ],
        [
          79.01990049751244,
          111.27694859038142
        ],
        [
          83.99502487562188,
          112.76948590381426
        ],
        [
          87.64344941956882,
          115.75456053067992
        ],
        [
          87.4776119402985,
          120.56384742951907
        ],
        [
          84.99004975124377,
          123.54892205638474
        ]
      ],
      "group_id": 2,
      "shape_type": "polygon",
      "flags": {}
    }
  ],
  "imagePath": "..\\resize_data\\melt_pool_1.jpg",
  "imageData": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCADgAOADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD5/ooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKuWGnXGozCOCNm9SB0r0bQvhLdajErvFKSfagDy2ivXNW+Dd3Zwu6RSDHQ15zq+g3ekSssqHaO+OlAGTRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUVoafot/qgJtYS4HegDPqxZWj3t0kKDljV688OapY4862YA9xXR+AtGeXVA0sfOQMGgD1/4bfDu3S2S6uF+QAduvtXsMFvFbRLHCgRAMACq2kWy2ulW8SqBhATV+gBjosilXUMp6givN/iH4Gtr6xkureFQcfMMdK9LqC6hW4tJYnGQykYoA+Gda0x9Mv3iK4XPFZtek/FDTFt76R1XGHrzagAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigB8YBkUHpkZr6k+EuhaXJou826sQo618sV6V8PviNdeHn8iSYhcYGTwaAPoPxb4V0u504y/Z1Vl4+XvXmuh6TDY6ywRTgMMVf1P4ltqVkqrIvOOhqho+om4vy5xyR0oA91syDZwkdNgqes3RLkT6fGM5KitKgApkh2xsT0ANPrO1m8W00+Q5AZhgUAfN/xWZXnnI/vGvIa9P+Itx50kp9zXmFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQBp6ZdyLIsZJIHTmvTvDM+HQ5ryexOLgV6PoM+3ZzQB7n4f1byo0G6uui1SCRck4rx7TdR2qvzVvR6sQv3v1oA7681eKCJmTlh0zXmuu+L/ttxNalHDpnJPSpLzVWKH5j+dcRqUv76ST1zQBxnjCbzS5964Ouu8Qybw1cjQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUATWrbZhXaaTcbQvNcPG21wa6PT58BeaAPQrO/wBzWrHqPy/eriLe7wBzWjFecdaAOjnvsjrWPeyFonOc1B9q3dTUNzdKIWBIz6UAcjrTZ3VzNbusShi2KwqACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigArUs5sAc1l1NBJtbFAHSQ3PHWtCG6461zcc2O9Wo7n3oA6IXQ9azry7+dsGqn2rjrVS5m4LZ60AUb6Xe2KpU+Vtzk0ygAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKAJElI6mpln96q0UAXxP71HPLujx71V3H1oLE0AJRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQB//2Q==",
  "imageHeight": 224,
  "imageWidth": 224
}
4

0 回答 0