biigle / core

:large_blue_circle: Application core of BIIGLE
https://biigle.de
GNU General Public License v3.0
12 stars 15 forks source link

Video annotation after object tracking is not deleted at first attempt #601

Closed mzur closed 1 year ago

mzur commented 1 year ago

I observed a strange issue where a video annotation (with object tracking) was only deleted on the second attempt.

Steps to reproduce:

  1. Create a video annotation with object tracking
  2. Wait for the tracking to finish
  3. Select the finished annotation
  4. Press Del and confirm to delete the annotation.

The annotation will disappear but won't be deleted. It is still visible in the timeline. Instead of a DELETE request, a PUT request is sent (i.e. an update). The annotation is deleted on the second attempt when I click on the delete button in the toolbar.

Here is a video that demonstrates the issue. While it shows two annotations, the issue occurs also with a single annotation.

https://github.com/biigle/core/assets/2457311/32b88ba1-addd-4b59-9d56-08c1e8d77bc0

lehecht commented 1 year ago

Is there a reason why deleteKeyFrame in /resources/assets/js/videos/models/Annotation.vue uses 'update' but not 'delete'?

mzur commented 1 year ago

Yes, if you delete a key frame you update the annotation e.g. from this:

points: [[x1,y1],[x2,y2],[x3,y3]]
frames: [a,b,c]

to this:

points: [[x1,y1],[x3,y3]]
frames: [a,c]

So the operation should not delete the whole annotation but only update it (to remove an entry in the points and frames arrays).

lehecht commented 1 year ago

Can you explain the if statement in deleteAnnotationOrKeyFrame? If an object tracking annotation should be deleted and the current time is equal to the annotation start time, then only a key frame is deleted. That is the case when the start time is rounded. The whole annotation is deleted, if the annotation start was not rounded, so hasKeyFrame() is false. Is there a reason why you just check the key frames and not also what type of annotation (tracking, whole frame, etc.) should be deleted?

mzur commented 1 year ago

Ah now I understand what's going on. But first to your question:

Is there a reason why you just check the key frames and not also what type of annotation (tracking, whole frame, etc.) should be deleted?

All annotations with isClip should be treated the same. If a keyframe is selected and Del is pressed, the keyframe should be deleted. And the keyframe is identified by the current time. Besides, "tracking" is not really an annotation type. The result of the object tracking is just a regular multi-frame point/circle annotation.

So here is what I think is going on: The tracking produces a multi-frame annotation. In the video above, I selected the new annotation with a click on the circle (without changing the current time). So when I pressed Del, the first keyframe of the annotation was deleted. But since the annotation was produced with tracking, it's unnoticeable (because the keyframes are so close next to each other). The second time I hit Del, the keyframe for the current time was gone and thus the whole annotation was deleted.

This seems to be no bug after all. Just "unexpected behavior". While the behavior could be improved, I think a solution would be quite complex. So I'd rather just close this. Any objections?

lehecht commented 1 year ago

You can close this issue.