Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python xml中的注释是否转换为json?_Python_Tensorflow_Machine Learning_Keras_Computer Vision - Fatal编程技术网

Python xml中的注释是否转换为json?

Python xml中的注释是否转换为json?,python,tensorflow,machine-learning,keras,computer-vision,Python,Tensorflow,Machine Learning,Keras,Computer Vision,我正在使用MASK RCNNkeras和tensorflow,我想知道是否有人能够使用xml注释文件进行培训,或者是否有人将xml转换为json。 如果我将xml文件更改为json,有人能给我举个例子说明如何使用load_uuz()函数吗 我用VIA工具做了一些注释,它是正确的,(训练和检测),但我真的很想使用xml注释,因为它们已经完成,重新开始需要很长时间 我已将xml文件转换为json,但我的注释中没有多边形或区域,我如何使用它? 多谢各位 我将不胜感激 annotations1 = js

我正在使用MASK RCNNkeras和tensorflow,我想知道是否有人能够使用xml注释文件进行培训,或者是否有人将xml转换为json。 如果我将xml文件更改为json,有人能给我举个例子说明如何使用load_uuz()函数吗

我用VIA工具做了一些注释,它是正确的,(训练和检测),但我真的很想使用xml注释,因为它们已经完成,重新开始需要很长时间

我已将xml文件转换为json,但我的注释中没有多边形或区域,我如何使用它? 多谢各位

我将不胜感激

annotations1 = json.load(open(os.path.join(dataset_dir, "dataset.json")))

        annotations = list(annotations1.values())  # don't need the dict keys

        annotations = [a for a in annotations if a['images']]

        for a in annotations:

            polygons = [r['shape_attributes'] for r in a['regions'].values()]

            image_path = os.path.join(dataset_dir, a['filename'])
            image = skimage.io.imread(image_path)
            height, width = image.shape[:2]

            self.add_image(
                "damage",  
                image_id=a['filename'],  
                path=image_path,
                width=width, height=height,
                polygons=polygons)

您需要创建自己的脚本以将XML转换为JSON,或者只需删除
load\u mask()
函数。

谢谢,我已经创建了自己的脚本以将XML转换为JSON,而且我还必须创建矩形区域之间的点,因为您需要多边形形状。