diff --git a/src/features/review/labelMiddleware.js b/src/features/review/labelMiddleware.js index 623d0f7e..353395f1 100644 --- a/src/features/review/labelMiddleware.js +++ b/src/features/review/labelMiddleware.js @@ -52,7 +52,7 @@ export const labelMiddleware = (store) => (next) => (action) => { editLabel('create', 'objects', { objects: tempObjs.map(({ newObject, imgId }) => { const obj = _.cloneDeep(newObject); - obj.labels = obj.labels.map((lbl) => ({ ...lbl, imageId: imgId })); + obj.labels = obj.labels.map((lbl) => ({ ...lbl, imageId: imgId, objectId: obj._id })); return { object: obj, imageId: imgId, diff --git a/src/features/review/objectMiddleware.js b/src/features/review/objectMiddleware.js index 4ce77693..440392f1 100644 --- a/src/features/review/objectMiddleware.js +++ b/src/features/review/objectMiddleware.js @@ -59,8 +59,9 @@ export const objectMiddleware = (store) => (next) => (action) => { const { images, userId } = action.payload; action.payload.images = images.map((img) => { + const newObjectId = new ObjectID().toString(); img.newObject = img.newObject || { - _id: new ObjectID().toString(), + _id: newObjectId, bbox: [0, 0, 1, 1], locked: true, labels: [ @@ -68,6 +69,7 @@ export const objectMiddleware = (store) => (next) => (action) => { _id: new ObjectID().toString(), imageId: img.imgId, labelId: 'empty', + objectId: newObjectId, bbox: [0, 0, 1, 1], validation: { validated: true, userId }, conf: 1,