label-studio
label-studio copied to clipboard
When i use machine learning, it will call twice, and the result repeat twice
version:
machine learning config:
action :
first interactive call
first interactive result
second interactive call
second interactive result
third call
third result
fourth call
fourth result
use default mmdetection examples
How to use machine learning?
The result is a little strange. Did I use it wrong?
Hi @mengfu188 You used it right. It seems that duplicate results are connected with double calls of interactive annotation - our front end merges all results. I have asked our front end team to check this issue. Meanwhile, if you don't want to wait the fix you can add filter for duplicate results in ML backend.
Hello @KonstantinKorotaev Another question is if i use bicycle tag to auto rectangle. The front end will turn all labels into bicycles. But the back end gives different labels. I use this example https://github.com/heartexlabs/label-studio-ml-backend/tree/master/label_studio_ml/examples/mmdetection
How to use machine learning? The result is a little strange. Did I use it wrong?
I have the exact same problem. The browser calls interactive-annotating twice and all the labels are added twice.
I am running the latest version:
"release": "1.6.0",
"label-studio-os-package": {
"version": "1.6.0",
"short_version": "1.6",
"latest_version_from_pypi": "1.6.0",
"latest_version_upload_time": "2022-09-27T17:09:34",
"current_version_is_outdated": false
},
"label-studio-os-backend": {
"message": "Bump rc5",
"commit": "b0df5dd19a5400e8d26fb8269e2add87799af055",
"date": "2022-09-27 16:32:57 +0100",
"branch": "HEAD",
"version": "1.6.0+0.gb0df5dd.dirty"
},
"label-studio-frontend": {
"message": "fix: DEV-3510: fix video regions w/o label",
"commit": "5d4231c2a8b9703f8c43abdf62948ac892d6f742",
"branch": "master",
"date": "2022/09/27 13:58:00"
},
"dm2": {
"message": "feat: DEV-3373: Enable video preview (#106) * Enable video preview ...",
"commit": "8374cbfeceb5aa9870278fc5371f0585d452c111",
"branch": "master",
"date": "2022-09-27T08:11:03Z"
},
"label-studio-converter": {
"version": "0.0.44"
},
"label-studio-ml": {
"version": "1.0.8.rc3"
}
}
If anybody else has the same problem, as a workaround, I cache the last request and return empty predictions if the current one is equal to the last one. This technically creates race condition, if two users initiate a prediction, but my deployment is small enough to accept that risk.
last_tasks = None
def predict(self, tasks: List[dict], **kwargs):
# https://github.com/heartexlabs/label-studio/issues/2546
if tasks == self.last_tasks:
logging.warning("Double request, returning 0 predictions.")
self.last_tasks = None
return []
self.last_tasks = tasks
# actual prediction starts here