def main(argv):
    if len(argv) < 2:
        if str(argv[0]).endswith(".manifest"):
            path = argv[0]
        else:
            path = os.path.abspath('../../../') + "/resources/V010.manifest"
        data_set = manifest.parse_manifest(path)
        chinese = False
        for sample in data_set.get_sample_list():
            for annotation in sample.get_annotations():
                print(annotation.get_name())
                if ("向日葵" == annotation.get_name()):
                    chinese = True
        assert chinese
    elif len(argv) < 3:
        data_set = manifest.parse_manifest(argv[1])
        validate(data_set)
    else:
        path = argv[1]
        ak = argv[2]
        sk = argv[3]
        endpoint = argv[4]
        data_set = manifest.parse_manifest(manifest_path=path,
                                           access_key=ak,
                                           secret_key=sk,
                                           end_point=endpoint)
        chinese = False
        for sample in data_set.get_sample_list():
            for annotation in sample.get_annotations():
                print(annotation.get_name())
                if ("向日葵" == annotation.get_name()):
                    chinese = True
        assert chinese
示例#2
0
def main(argv):
  path = os.path.abspath('../../../') + "/resources/classification-xy-V201902220937263726_4.manifest"
  dataset = create_manifest()
  if len(argv) < 2:
    dataset.save(path)
    para = []
    para.append(path)
    data_set = parse_manifest(path)
    validate(data_set)
  else:
    path2 = argv[1]
    ak = argv[2]
    sk = argv[3]
    endpoint = argv[4]
    dataset.save(path2, ak, sk, endpoint)
    data_set = parse_manifest(path2, ak, sk, endpoint)
    validate(data_set)
def main(argv):
    if len(argv) < 2:
        if str(argv[0]).endswith(".manifest"):
            path = argv[0]
        else:
            path = os.path.abspath('../../../') + "/resources/V002.manifest"
        data_set = manifest.parse_manifest(path)
        validate(data_set)
    elif len(argv) < 3:
        data_set = manifest.parse_manifest(argv[1])
        validate(data_set)
    else:
        path = "s3://carbonsouth/manifest/V002.manifest"
        ak = argv[1]
        sk = argv[2]
        endpoint = argv[3]
        data_set = manifest.parse_manifest(path, ak, sk, endpoint)
        validate(data_set)
def main(argv):
  if len(argv) < 2:
    if str(argv[0]).endswith(".manifest"):
      path = argv[0]
    else:
      path = os.path.abspath('../../../') + "/resources/classification-xy-V201902220937263726.manifest"
    data_set = manifest.parse_manifest(path)
    validate(data_set)
  elif len(argv) < 3:
    data_set = manifest.parse_manifest(argv[1])
    validate(data_set)
  else:
    path = argv[1]
    ak = argv[2]
    sk = argv[3]
    endpoint = argv[4]
    data_set = manifest.parse_manifest(manifest_path=path, access_key=ak, secret_key=sk, end_point=endpoint)
    validate(data_set)
def main(argv):
    if len(argv) < 2:
        if str(argv[0]).endswith(".manifest"):
            path = argv[0]
        else:
            path = os.path.abspath(
                '../../../'
            ) + "/resources/detect-test-xy-V201902220951335133.manifest"
        data_set = manifest.parse_manifest(path)
        validate(data_set)
    elif len(argv) < 3:
        data_set = manifest.parse_manifest(argv[1])
        validate(data_set)
    else:
        path = argv[1]
        ak = argv[2]
        sk = argv[3]
        endpoint = argv[4]
        data_set = manifest.parse_manifest(path, ak, sk, endpoint)
        validate(data_set)
def main(argv):
    if len(argv) < 2:
        path_base = os.path.abspath('../../../resources')
        path1 = path_base + "/detect-multi-local-voc.manifest"
        test_multi_default(path1)
        test_multi_exactly_match_type(path1)

        dataset = manifest.parse_manifest(path1)
        sample_num = dataset.get_size()
        for i in range(sample_num):
            sample = dataset.get_sample_list()[i]
            print("sample ", i)
            if len(sample.get_annotations()) == 1:
                validate_single_annotation_sample(sample)
                annotation = sample.get_annotations()[0]
                if "2007_000027" in annotation.get_loc():
                    path2 = path_base + annotation.get_loc()[1:]
                    pascal_voc = PascalVocIO.parse_xml(path2)
                    test_read_voc_xml_local.validate_uk(pascal_voc)
                    print("test read VOC xml from UK: Success")
                if "000000089955_1556180702627" in annotation.get_loc():
                    path2 = path_base + annotation.get_loc()[1:]
                    pascal_voc = PascalVocIO.parse_xml(path2)
                    test_read_voc_xml_local.validate(pascal_voc)
                    print("test read VOC xml: Success")
            else:
                annotations = sample.get_annotations()
                for annotation in annotations:
                    assert annotation.get_annotation_format() == "PASCAL VOC"
                    assert annotation.get_annotated_by() == "human"
                    assert annotation.get_type(
                    ) == "modelarts/object_detection"
                    if "2007_000027" in annotation.get_loc():
                        path2 = path_base + annotation.get_loc()[1:]
                        pascal_voc = PascalVocIO.parse_xml(path2)
                        test_read_voc_xml_local.validate_uk(pascal_voc)
                        print("test read VOC xml from UK: Success")
                    if "000000089955_1556180702627" in annotation.get_loc():
                        path2 = path_base + annotation.get_loc()[1:]
                        pascal_voc = PascalVocIO.parse_xml(path2)
                        test_read_voc_xml_local.validate(pascal_voc)
                        print("test read VOC xml: Success")
        print("test local Success")
    elif len(argv) < 3:
        path1 = argv[1]
        path_base = path1[:path1.rfind('/')]
        test_multi_default(path1)
        test_multi_exactly_match_type(path1)

        dataset = manifest.parse_manifest(path1)
        sample_num = dataset.get_size()
        for i in range(sample_num):
            sample = dataset.get_sample_list()[i]
            print("sample ", i)
            if len(sample.get_annotations()) == 1:
                validate_single_annotation_sample(sample)
                annotation = sample.get_annotations()[0]
                if "2007_000027" in annotation.get_loc():
                    path2 = path_base + annotation.get_loc()[1:]
                    pascal_voc = PascalVocIO.parse_xml(path2)
                    test_read_voc_xml_local.validate_uk(pascal_voc)
                    print("test read VOC xml from UK: Success")
                if "000000089955_1556180702627" in annotation.get_loc():
                    path2 = path_base + annotation.get_loc()[1:]
                    pascal_voc = PascalVocIO.parse_xml(path2)
                    test_read_voc_xml_local.validate(pascal_voc)
                    print("test read VOC xml: Success")
            else:
                annotations = sample.get_annotations()
                for annotation in annotations:
                    assert annotation.get_annotation_format() == "PASCAL VOC"
                    assert annotation.get_annotated_by() == "human"
                    assert annotation.get_type(
                    ) == "modelarts/object_detection"
                    if "2007_000027" in annotation.get_loc():
                        path2 = path_base + annotation.get_loc()[1:]
                        pascal_voc = PascalVocIO.parse_xml(path2)
                        test_read_voc_xml_local.validate_uk(pascal_voc)
                        print("test read VOC xml from UK: Success")
                    if "000000089955_1556180702627" in annotation.get_loc():
                        path2 = path_base + annotation.get_loc()[1:]
                        pascal_voc = PascalVocIO.parse_xml(path2)
                        test_read_voc_xml_local.validate(pascal_voc)
                        print("test read VOC xml: Success")
    else:
        path_base = "s3://obs-dataset-sjy"
        path1 = path_base + "/detect-multi-local-voc.manifest"
        ak = argv[1]
        sk = argv[2]
        endpoint = argv[3]
        test_multi_default(path1, ak, sk, endpoint)
        test_multi_exactly_match_type(path1, ak, sk, endpoint)

        dataset = manifest.parse_manifest(path1, ak, sk, endpoint)
        sample_num = dataset.get_size()
        for i in range(sample_num):
            sample = dataset.get_sample_list()[i]
            print("sample ", i)
            if len(sample.get_annotations()) == 1:
                validate_single_annotation_sample(sample)
                annotation = sample.get_annotations()[0]
                if "2007_000027" in annotation.get_loc():
                    path2 = path_base + annotation.get_loc()[1:]
                    pascal_voc = PascalVocIO.parse_xml(path2, ak, sk, endpoint)
                    test_read_voc_xml_local.validate_uk(pascal_voc)
                    print("test read VOC xml from UK: Success")
                if "000000089955_1556180702627" in annotation.get_loc():
                    path2 = path_base + annotation.get_loc()[1:]
                    pascal_voc = PascalVocIO.parse_xml(path2, ak, sk, endpoint)
                    test_read_voc_xml_local.validate(pascal_voc)
                    print("test read VOC xml: Success")
            else:
                annotations = sample.get_annotations()
                for annotation in annotations:
                    assert annotation.get_annotation_format() == "PASCAL VOC"
                    assert annotation.get_annotated_by() == "human"
                    assert annotation.get_type(
                    ) == "modelarts/object_detection"
                    if "2007_000027" in annotation.get_loc():
                        path2 = path_base + annotation.get_loc()[1:]
                        pascal_voc = PascalVocIO.parse_xml(
                            path2, ak, sk, endpoint)
                        test_read_voc_xml_local.validate_uk(pascal_voc)
                        print("test read VOC xml from UK: Success")
                    if "000000089955_1556180702627" in annotation.get_loc():
                        path2 = path_base + annotation.get_loc()[1:]
                        pascal_voc = PascalVocIO.parse_xml(
                            path2, ak, sk, endpoint)
                        test_read_voc_xml_local.validate(pascal_voc)
                        print("test read VOC xml: Success")
        print("test OBS Success")