diff --git a/CHANGELOG.md b/CHANGELOG.md index 56cd25b2..41419f59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Auto annotation fail for multijob tasks - Installation of CVAT with OpenVINO on the Windows platform - Background color was always black in utils/mask/converter.py +- Exception in attribute annotation mode when a label are switched to a value without any attributes - Handling of wrong labelamp json file in auto annotation (https://github.com/opencv/cvat/issues/554) ### Security diff --git a/cvat/apps/engine/static/engine/js/attributeAnnotationMode.js b/cvat/apps/engine/static/engine/js/attributeAnnotationMode.js index ece1d78b..b5a85c79 100644 --- a/cvat/apps/engine/static/engine/js/attributeAnnotationMode.js +++ b/cvat/apps/engine/static/engine/js/attributeAnnotationMode.js @@ -130,14 +130,18 @@ class AAMModel extends Listener { _activate() { if (this._activeAAM && this._active) { const { label } = this._active; - const attrId = +this._attrIdByIdx(label, this._attrNumberByLabel[label].current); + const [xtl, ytl, xbr, ybr] = this._bbRect(this._currentShapes[this._activeIdx] .interpolation.position); this._focus(xtl - this._margin, xbr + this._margin, ytl - this._margin, ybr + this._margin); this.notify(); - this._active.activeAttribute = attrId; + + if (typeof (this._attrNumberByLabel[label]) !== 'undefined') { + const attrId = +this._attrIdByIdx(label, this._attrNumberByLabel[label].current); + this._active.activeAttribute = attrId; + } } else { this.notify(); } @@ -211,6 +215,9 @@ class AAMModel extends Listener { } const curAttr = this._attrNumberByLabel[this._active.label]; + if (typeof (curAttr) === 'undefined') { + return; + } if (curAttr.end < 2) { return; @@ -238,6 +245,10 @@ class AAMModel extends Listener { } const { label } = this._active; const frame = window.cvat.player.frames.current; + if (typeof (this._attrNumberByLabel[label]) === 'undefined') { + return; + } + const attrId = this._attrIdByIdx(label, this._attrNumberByLabel[label].current); const attrInfo = window.cvat.labelsInfo.attrInfo(attrId); if (key >= attrInfo.values.length) { @@ -266,8 +277,11 @@ class AAMModel extends Listener { generateHelps() { if (this._active) { const { label } = this._active; - const attrId = +this._attrIdByIdx(label, this._attrNumberByLabel[label].current); - return [this._helps[attrId].title, this._helps[attrId].help, `${this._activeIdx + 1}/${this._currentShapes.length}`]; + if (typeof (this._attrNumberByLabel[label]) !== 'undefined') { + const attrId = +this._attrIdByIdx(label, this._attrNumberByLabel[label].current); + return [this._helps[attrId].title, this._helps[attrId].help, `${this._activeIdx + 1}/${this._currentShapes.length}`]; + } + return ['No Attributes Found', '', `${this._activeIdx + 1}/${this._currentShapes.length}`]; } return ['No Shapes Found', '', '0/0']; }