Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Remember labelling mode #507

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/webserver/api/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def get(self, dataset_id):
# Perform mongodb query
images = current_user.images \
.filter(query_build) \
.order_by(order).only('id', 'file_name', 'annotating', 'annotated', 'num_annotations')
.order_by(order).only('id', 'file_name', 'annotating', 'annotated', 'num_annotations', 'category_ids')

total = images.count()
pages = int(total/per_page) + 1
Expand Down
12 changes: 8 additions & 4 deletions client/src/components/annotator/FileTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
v-show="previousimage != null"
class="fa fa-arrow-left image-arrows"
style="float:left"
@click="route(previousimage)"
@click="route(previousimage, labelmode)"
/>
<i
v-show="nextimage != null"
class="fa fa-arrow-right image-arrows"
style="float:right"
@click="route(nextimage)"
@click="route(nextimage, labelmode)"
/>

<h6 class="text-center" style="color: white;">
Expand All @@ -36,6 +36,10 @@ export default {
nextimage: {
type: Number,
default: null
},
labelmode: {
type: String,
required: false
}
},
methods: {
Expand All @@ -44,13 +48,13 @@ export default {
*
* @param {Number} identifer id of a file
*/
route(identifier) {
route(identifier, labelmode) {
// Make sure we pop the latest session before annotations
this.$parent.current.annotation = -1;

this.$nextTick(() => {
this.$parent.save(() => {
this.$router.push({ name: "annotate", params: { identifier } });
this.$router.push({ name: "annotate", params: { identifier, labelmode } });
});
});
}
Expand Down
16 changes: 10 additions & 6 deletions client/src/views/Annotator.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div style="display: block; height: inherit;">

<aside v-show="panels.show.left" class="left-panel shadow-lg">
<div v-show="mode == 'segment'">
<hr />
Expand Down Expand Up @@ -99,6 +98,7 @@
<FileTitle
:previousimage="image.previous"
:nextimage="image.next"
:labelmode="this.mode"
:filename="image.filename"
ref="filetitle"
/>
Expand Down Expand Up @@ -304,6 +304,10 @@ export default {
identifier: {
type: [Number, String],
required: true
},
labelmode: {
type: [String],
required: false
}
},
data() {
Expand All @@ -313,7 +317,7 @@ export default {
shapeOpacity: 0.6,
zoom: 0.2,
cursor: "move",
mode: "segment",
mode: this.labelmode || "segment",
simplify: 1,
panels: {
show: {
Expand Down Expand Up @@ -429,7 +433,7 @@ export default {
onpinchstart(e) {
e.preventDefault();
if (!this.doneLoading) return;
let view = this.paper.view;
// let view = this.paper.view;
this.pinching.old_zoom = this.paper.view.zoom;
return false;
},
Expand Down Expand Up @@ -628,7 +632,7 @@ export default {
}
if (indices.keypoint !== -1) {
this.current.keypoint = indices.keypoint;
let ann = this.currentCategory.category.annotations[this.current.annotation];
// let ann = this.currentCategory.category.annotations[this.current.annotation];
let kpTool = this.$refs.keypoint;
let selectTool = this.$refs.select;
let category = this.$refs.category[this.current.category];
Expand Down Expand Up @@ -919,11 +923,11 @@ export default {
},
nextImage() {
if(this.image.next != null)
this.$refs.filetitle.route(this.image.next);
this.$refs.filetitle.route(this.image.next, this.mode);
},
previousImage() {
if(this.image.previous != null)
this.$refs.filetitle.route(this.image.previous);
this.$refs.filetitle.route(this.image.previous, this.mode);
}
},
watch: {
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ services:
- "./backend/database:/workspace/database"
- "./datasets:/datasets"
- "./models:/models"
user: ${CURRENT_UID}
environment:
- FILE_WATCHER=true
- FLASK_APP=webserver
Expand Down Expand Up @@ -81,6 +82,7 @@ services:
- 5555:5555
networks:
- cocoannotator
user: ${CURRENT_UID}
database:
image: mongo:4.0
container_name: annotator_mongodb
Expand Down