|
22 | 22 | import java.util.stream.Collectors; |
23 | 23 |
|
24 | 24 | public class JSONLoadStrategy implements ImageAnnotationLoadStrategy { |
25 | | - private static final String OBJECT_CATEGORY_SERIALIZED_NAME = "name"; |
| 25 | + private static final String OBJECT_CATEGORY_NAME_SERIALIZED_NAME = "name"; |
| 26 | + private static final String OBJECT_CATEGORY_SERIALIZED_NAME = "category"; |
26 | 27 | private static final String OBJECT_COLOR_SERIALIZED_NAME = "color"; |
27 | 28 | private static final String IMAGE_META_DATA_SERIALIZED_NAME = "image"; |
28 | 29 | private static final String BOUNDING_SHAPE_DATA_SERIALIZED_NAME = "objects"; |
@@ -212,15 +213,15 @@ public ObjectCategory deserialize(JsonElement json, java.lang.reflect.Type type, |
212 | 213 | JsonDeserializationContext context) throws JsonParseException { |
213 | 214 | final JsonObject jsonObject = json.getAsJsonObject(); |
214 | 215 |
|
215 | | - if(!jsonObject.has(OBJECT_CATEGORY_SERIALIZED_NAME)) { |
| 216 | + if(!jsonObject.has(OBJECT_CATEGORY_NAME_SERIALIZED_NAME)) { |
216 | 217 | unParsedFileErrorMessages |
217 | 218 | .add(new IOResult.ErrorInfoEntry(annotationFileName, |
218 | 219 | MISSING_CATEGORY_NAME_ERROR_MESSAGE + currentFilename.get() + |
219 | 220 | ".")); |
220 | 221 | return null; |
221 | 222 | } |
222 | 223 |
|
223 | | - final String categoryName = jsonObject.get(OBJECT_CATEGORY_SERIALIZED_NAME).getAsString(); |
| 224 | + final String categoryName = jsonObject.get(OBJECT_CATEGORY_NAME_SERIALIZED_NAME).getAsString(); |
224 | 225 |
|
225 | 226 | Color categoryColor; |
226 | 227 |
|
@@ -431,7 +432,7 @@ public BoundingBoxData deserialize(JsonElement json, java.lang.reflect.Type type |
431 | 432 | JsonDeserializationContext context) throws JsonParseException { |
432 | 433 | final JsonObject jsonObject = json.getAsJsonObject(); |
433 | 434 |
|
434 | | - if(!jsonObject.has(OBJECT_CATEGORY_SERIALIZED_NAME)) { |
| 435 | + if(!jsonObject.has("category")) { |
435 | 436 | unParsedFileErrorMessages.add(new IOResult.ErrorInfoEntry(annotationFileName, |
436 | 437 | BOX_MISSING_CATEGORY_ERROR_MESSAGE + |
437 | 438 | currentFileName.get() + ".")); |
|
0 commit comments