편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2021.05.25

    json 파일에서의 특정 값만 추출


    {
        "1.png896616":{
            "filename":"1.png",
            "size":896616,
            "regions":[
                {
                    "shape_attributes":{
                        "name":"polygon",
                        "all_points_x":[
                            286,284,......
                        ],
                        "all_points_y":[
                            94,93,....
                        ]
                    },
                    "region_attributes":{
                         "sweet_pepper":"YELLOW"
                    }
                },
                {
                    "shape_attributes":{
                        "name":"polygon",
                        "all_points_x":[
                            455,457,...
                        ],
                        "all_points_y":[
                            194,202,...
                        ]
                    },
                    "region_attributes":{
                        "sweet_pepper":"YELLOW"
                    }
                },
                {
                    "shape_attributes":{
                        "name":"polygon",
                        "all_points_x":[
                            295,294,...
                        ],
                        "all_points_y":[
                            426,437,...
                        ]
                    },
                    "region_attributes":{
                        "sweet_pepper":"RED"
                    }
                }
            ],
            "file_attributes":{}
        },
        "2.png810690":{
            "filename":"2.png",
            "size":810690,
            "regions":[
                {
                    "shape_attributes":{
                        "name":"polygon",
                        "all_points_x":[
                            257,246,...
                        ],
                        "all_points_y":[
                            18,16,...
                            ]
                        },
                        "region_attributes":{
                            "sweet_pepper":"YELLOW"
                        }
                    },
                    {
                        "shape_attributes":{
                            "name":"polygon",
                            "all_points_x":[
                                439,466,...
                            ],
                            "all_points_y":[
                                93,115,...
                            ]
                        },
                        "region_attributes":{
                            "sweet_pepper":"YELLOW"
                        }
                    },
                    {
                        "shape_attributes":{
                            "name":"polygon",
                            "all_points_x":[
                                283,284...
                            ],
                            "all_points_y":[
                                355,381,...
                            ]
                        },
                        "region_attributes":{
                            "sweet_pepper":"RED"
                        }
                    },
                    {
                        "shape_attributes":{
                            "name":"polygon",
                            "all_points_x":[
                                193,176,...
                            ],
                            "all_points_y":[
                                169,174,...
                            ]
                        },
                        "region_attributes":{
                            "sweet_pepper":"GREEN"
                        }
                    }
                ],
                "file_attributes":{
                }
        }
    }
    

    json 파일 형식은 이렇습니다. 여기서는 2개의 이미지에 대한 json파일만 넣어놨지만, 실제로는 40개가 넘습니다.

    저는 all_points_x, all_points_y에 대한 값들만 뽑아내고 싶은데 방법을 어떻게 해야할 지 모르겠어요. all_points_x, all_points_y의 값은 1.png896616(혹은 2.png810690) -> regions -> shape_attributes 안에 포함되어있습니다.

    이미지가 1개일 경우에 all_points_x와 all_points_y는 추출했는데 이게 2개 이상 되어버리니까 어떻게 해야할 지 모르겠어요.

    이미지 1개마다 따로따로 추출해야하나요?

  • 프로필 알 수 없는 사용자님의 편집
    날짜2021.05.24

    json 파일에서의 특정 값만 추출


    {
        "1.png896616":{
            "filename":"1.png",
            "size":896616,
            "regions":[
                {
                    "shape_attributes":{
                        "name":"polygon",
                        "all_points_x":[
                            286,284,......
                        ],
                        "all_points_y":[
                            94,93,....
                        ]
                    },
                    "region_attributes":{
                         "sweet_pepper":"YELLOW"
                    }
                },
                {
                    "shape_attributes":{
                        "name":"polygon",
                        "all_points_x":[
                            455,457,...
                        ],
                        "all_points_y":[
                            194,202,...
                        ]
                    },
                    "region_attributes":{
                        "sweet_pepper":"YELLOW"
                    }
                },
                {
                    "shape_attributes":{
                        "name":"polygon",
                        "all_points_x":[
                            295,294,...
                        ],
                        "all_points_y":[
                            426,437,...
                        ]
                    },
                    "region_attributes":{
                        "sweet_pepper":"RED"
                    }
                }
            ],
            "file_attributes":{}
        },
        "2.png810690":{
            "filename":"2.png",
            "size":810690,
            "regions":[
                {
                    "shape_attributes":{
                        "name":"polygon",
                        "all_points_x":[
                            257,246,...
                        ],
                        "all_points_y":[
                            18,16,...
                            ]
                        },
                        "region_attributes":{
                            "sweet_pepper":"YELLOW"
                        }
                    },
                    {
                        "shape_attributes":{
                            "name":"polygon",
                            "all_points_x":[
                                439,466,...
                            ],
                            "all_points_y":[
                                93,115,...
                            ]
                        },
                        "region_attributes":{
                            "sweet_pepper":"YELLOW"
                        }
                    },
                    {
                        "shape_attributes":{
                            "name":"polygon",
                            "all_points_x":[
                                283,284...
                            ],
                            "all_points_y":[
                                355,381,...
                            ]
                        },
                        "region_attributes":{
                            "sweet_pepper":"RED"
                        }
                    },
                    {
                        "shape_attributes":{
                            "name":"polygon",
                            "all_points_x":[
                                193,176,...
                            ],
                            "all_points_y":[
                                169,174,...
                            ]
                        },
                        "region_attributes":{
                            "sweet_pepper":"GREEN"
                        }
                    }
                ],
                "file_attributes":{
                }
        }
    }
    

    json 파일 형식은 이렇습니다. 여기서는 2개의 이미지에 대한 json파일만 넣어놨지만, 실제로는 40개가 넘습니다. 저는 all_points_x, all_points_y에 대한 값들만 뽑아내고 싶은데 방법을 어떻게 해야할 지 모르겠어요 all_points_x, all_points_y의 값은 1.png896616(혹은 2.png810690) -> regions -> shape_attributes 안에 포함되어있습니다 이미지가 1개일 경우에 all_points_x와 all_points_y는 추출했는데 이게 2개 이상 되어버리니까 어떻게 해야할 지 모르겠어요 이미지 1개마다 따로따로 추출해야하나요?