Fixed exception in attribute annotation mode (#571)

* Fixed bug Cannot read property 'current' of undefined at AAMModel.setupAttributeValue

* Updated changelog
main
Boris Sekachev 7 years ago committed by Nikita Manovich
parent 8fede3a6e6
commit d939b9c34a

@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Auto annotation fail for multijob tasks - Auto annotation fail for multijob tasks
- Installation of CVAT with OpenVINO on the Windows platform - Installation of CVAT with OpenVINO on the Windows platform
- Background color was always black in utils/mask/converter.py - 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) - Handling of wrong labelamp json file in auto annotation (https://github.com/opencv/cvat/issues/554)
### Security ### Security

@ -130,14 +130,18 @@ class AAMModel extends Listener {
_activate() { _activate() {
if (this._activeAAM && this._active) { if (this._activeAAM && this._active) {
const { label } = 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] const [xtl, ytl, xbr, ybr] = this._bbRect(this._currentShapes[this._activeIdx]
.interpolation.position); .interpolation.position);
this._focus(xtl - this._margin, xbr + this._margin, this._focus(xtl - this._margin, xbr + this._margin,
ytl - this._margin, ybr + this._margin); ytl - this._margin, ybr + this._margin);
this.notify(); 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 { } else {
this.notify(); this.notify();
} }
@ -211,6 +215,9 @@ class AAMModel extends Listener {
} }
const curAttr = this._attrNumberByLabel[this._active.label]; const curAttr = this._attrNumberByLabel[this._active.label];
if (typeof (curAttr) === 'undefined') {
return;
}
if (curAttr.end < 2) { if (curAttr.end < 2) {
return; return;
@ -238,6 +245,10 @@ class AAMModel extends Listener {
} }
const { label } = this._active; const { label } = this._active;
const frame = window.cvat.player.frames.current; const frame = window.cvat.player.frames.current;
if (typeof (this._attrNumberByLabel[label]) === 'undefined') {
return;
}
const attrId = this._attrIdByIdx(label, this._attrNumberByLabel[label].current); const attrId = this._attrIdByIdx(label, this._attrNumberByLabel[label].current);
const attrInfo = window.cvat.labelsInfo.attrInfo(attrId); const attrInfo = window.cvat.labelsInfo.attrInfo(attrId);
if (key >= attrInfo.values.length) { if (key >= attrInfo.values.length) {
@ -266,8 +277,11 @@ class AAMModel extends Listener {
generateHelps() { generateHelps() {
if (this._active) { if (this._active) {
const { label } = this._active; const { label } = this._active;
const attrId = +this._attrIdByIdx(label, this._attrNumberByLabel[label].current); if (typeof (this._attrNumberByLabel[label]) !== 'undefined') {
return [this._helps[attrId].title, this._helps[attrId].help, `${this._activeIdx + 1}/${this._currentShapes.length}`]; 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']; return ['No Shapes Found', '', '0/0'];
} }

Loading…
Cancel
Save