DigitalGlobe / GGD-gbdxm

A packaging tool for importing/exporting models readable by DeepCore based applications and tools
Apache License 2.0
1 stars 4 forks source link

Unable to set caffe output-layer through gbdxm pack using json for input #34

Closed grantporterdg closed 6 years ago

grantporterdg commented 6 years ago

Using a json file for input to gbdxm pack I am unable to have it set this value in the resulting metadata.json in the model package.

Test:

Feature: gbdxm pack # features/gbdxm_pack.feature:1
  In order to properly package model files
  I need to be able to use gbdxm
  @expect_error @derp
  Scenario: User invokes gbdxm pack for a caffe model with all possible parameters in a json config file    # features/gbdxm_pack.feature:83
    Given I am at a new command line                                                                        # features/steps/base_steps.py:8 0.000s
    When I issue the command                                                                                # features/steps/base_steps.py:14 0.358s
      """
      ../bin/gbdxm pack -j ../data/ctest/metadata.json -f ctestname.gbdxm
      """
    Then the number of files created should be "1"                                                          # features/steps/base_steps.py:66 0.000s
    And a file named "ctestname.gbdxm" should be created                                                    # features/steps/base_steps.py:72 0.000s
    And the archive "ctestname.gbdxm" should contain "4" files                                              # features/steps/archive_steps.py:6 0.000s
    And the archive "ctestname.gbdxm" should contain the following files                                    # features/steps/archive_steps.py:14 0.000s
      | file_name                      |
      | deploy.prototxt                |
      | snapshot_iter_21120.caffemodel |
      | metadata.json                  |
      | mean.binaryproto               |
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""mean" : "mean.binaryproto""        # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""model" : "deploy.prototxt""        # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""snapshot_iter_21120.caffemodel""   # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""modelVersion" : "2.2""             # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""type" : "caffe""                   # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""boundingBox" :"                    # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""category" : "classifier""          # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""colorMode" : "grayscale""          # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""description" : "test description"" # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""name" : "ctest""                   # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""size" :"                           # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""timeCreated" :"                    # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""name" : "ctest""                   # features/steps/archive_steps.py:23 0.000s
    And the file "metadata.json" in archive "ctestname.gbdxm" contains ""output-layer" : "testoutputlayer"" # features/steps/archive_steps.py:23 0.000s
      Assertion Failed: Could not find: "output-layer" : "testoutputlayer" In metadata: {
        "boundingBox" : 
        {
            "br" : 
            {
                "lat" : 90.0,
                "lon" : 180.0
            },
            "tl" : 
            {
                "lat" : -90.0,
                "lon" : -180.0
            }
        },
        "category" : "classifier",
        "colorMode" : "grayscale",
        "content" : 
        {
            "mean" : "mean.binaryproto",
            "model" : "deploy.prototxt",
            "trained" : "snapshot_iter_21120.caffemodel"
        },
        "description" : "test description",
        "labels" : 
        [
            "0",
            "1",
            "2",
            "3",
            "4",
            "5",
            "6",
            "7",
            "8",
            "9"
        ],
        "modelSize" : 
        {
            "height" : 28,
            "width" : 28
        },
        "modelVersion" : "2.2",
        "name" : "ctest",
        "size" : 1730088,
        "timeCreated" : "20171207T112215",
        "type" : "caffe",
        "version" : "3.0"
      }

    And The return code is "0"                                                                              # None

Input .json file:

{
    "boundingBox" : 
    {
        "br" : 
        {
            "lat" : 90.0,
            "lon" : 180.0
        },
        "tl" : 
        {
            "lat" : -90.0,
            "lon" : -180.0
        }
    },
    "category" : "classifier",
    "colorMode" : "grayscale",
    "content" : 
    {
        "mean" : "../data/ctest/mean.binaryproto",
        "model" : "../data/ctest/deploy.prototxt",
        "trained" : "../data/ctest/snapshot_iter_21120.caffemodel"
    },
    "description" : "test description",
    "labels" : 
    [
        "0",
        "1",
        "2",
        "3",
        "4",
        "5",
        "6",
        "7",
        "8",
        "9"
    ],
    "modelSize" : 
    {
        "height" : 28,
        "width" : 28
    },
    "modelVersion" : "2.2",
    "name" : "ctest",
    "options" : 
    {
        "output-layer" : "testoutputlayer"
    },
    "size" : 1726941,
    "timeCreated" : "20171207T112215",
    "type" : "caffe",
    "version" : "3.0"
}
grantporterdg commented 6 years ago

Same issue with all the "options" for tensorflow models.

    "options" : 
    {
        "confidence-layer" : "myconf",
        "input-datatype" : "myfloat",
        "input-layer" : "myinput",
        "mean" : "0.1",
        "output-layers" : "myoutput",
        "scale" : "1.1"
    },

Do not get imported into the metadata.json in the packed model.

rddesmond commented 6 years ago

Fixed with #41 and DigitalGlobe/GGD-DeepCore-Dev#683.