label-studio-ml-backend icon indicating copy to clipboard operation
label-studio-ml-backend copied to clipboard

When trying to use SAM the model in my label studio show this error in the logs about the predictions

Open juancalric opened this issue 1 year ago • 12 comments

File "/usr/local/lib/python3.8/site-packages/label_studio_ml/model.py", line 617, in predict
server         |     predictions = cls._current_model.model.predict(tasks, **kwargs)
server         |   File "/app/segment_anything_model.py", line 69, in predict
server         |     height = kwargs['context']['result'][0]['original_height']
server         | TypeError: 'NoneType' object is not subscriptable

my docker-compose

version: '3'

x-vision-common:
  &vision-common
  logging:
    options:
      max-size: "100m"
      max-file: "5"
    driver: json-file

services:
  postgres:
    <<: *vision-common
    image: postgres:13.4-alpine
    container_name: postgres
    restart: always
    environment:
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - ./volumes/postgres-data:/var/lib/postgresql/data
  #----------------------------------------------------------------------------
  #                                label Studio
  #----------------------------------------------------------------------------
  labelstudio:
    <<: *vision-common
    image: heartexlabs/label-studio:1.8.0
    container_name: labelstudio
    depends_on:
      - postgres
    environment:
      DJANGO_DB: default
      POSTGRE_NAME: ${POSTGRES_DB}
      POSTGRE_USER: ${POSTGRES_USER}
      POSTGRE_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRE_PORT: 5432
      POSTGRE_HOST: postgres
      LABEL_STUDIO_DISABLE_SIGNUP_WITHOUT_LINK: "false"
      LABEL_STUDIO_PORT: 80
    ports:
      - 8080:80
  #----------------------------------------------------------------------------
  #                                redis
  #----------------------------------------------------------------------------
  redis:
    image: redis:alpine
    container_name: redis
    hostname: redis
    volumes:
      - "./volumes/redis:/data"
    expose:
      - 6379
  sam:
    container_name: server
    build: ./docker/segment_anything_model/
    environment:
      - MODEL_DIR=/data/models
      - RQ_QUEUE_NAME=default
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - LABEL_STUDIO_USE_REDIS=true
    ports:
      - 9090:9090
    depends_on:
      - redis
    links:
      - redis
    volumes:
      - "./volumes/sam/data/server:/data"
      - "./volumes/sam/logs:/tmp"

juancalric avatar Jul 10 '23 19:07 juancalric

I have the same problem

Babars7 avatar Jul 13 '23 13:07 Babars7

I have the same problem

DimIsaev avatar Jul 18 '23 09:07 DimIsaev

Have you checked all of these settings?

https://github.com/heartexlabs/label-studio-ml-backend/pull/253#issuecomment-1640238453

shondle avatar Jul 18 '23 14:07 shondle

Have you checked all of these settings?

#253 (comment)

step 1 Connect backend ML

image

image

step 2

Check webhook image

Error

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/label_studio_ml/exceptions.py", line 39, in exception_f
    return f(*args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/label_studio_ml/api.py", line 51, in _predict
    predictions, model = _manager.predict(tasks, project, label_config, force_reload, try_fetch, **params)
  File "/home/user/.local/lib/python3.10/site-packages/label_studio_ml/model.py", line 617, in predict
    predictions = cls._current_model.model.predict(tasks, **kwargs)
  File "/home/user/label-studio-ml-backend/my_ml_backend/segment_anything_model.py", line 69, in predict
    height = kwargs['context']['result'][0]['original_height']
TypeError: 'NoneType' object is not subscriptable

DimIsaev avatar Jul 18 '23 16:07 DimIsaev

Same problem

Francesko90 avatar Jul 20 '23 10:07 Francesko90

I think that is related to #4493

Francesko90 avatar Jul 20 '23 13:07 Francesko90

As indicated here, the first attempt that was unsuccessful, the program doesn't stop. I was able to use this backend correctly. Be sure to follow this step:

  1. Settings on the frontend as indicated on the readme
  2. Creating annotation as indicated on the readme

In particular, is necessary to select the BrushLabe and the KeyPointLabels before add a keypoint

image

Francesko90 avatar Jul 26 '23 08:07 Francesko90

Still having the same..

pritamfocal avatar Aug 03 '23 09:08 pritamfocal

without changes error persisted

the individual setting is incomprehensible, maybe it decides something, but it is necessary that it would work in other conditions or describe exactly what each setting affects

DimIsaev avatar Aug 03 '23 09:08 DimIsaev

Please watch this video for setup. If this doesn't help, please send a short clip showing you running the back end, what you do on the front end to receive predictions, and the terminal output on the back end.

shondle avatar Aug 05 '23 05:08 shondle

Are you planning to fix this error or we forget about work together with SAM?

DimIsaev avatar Aug 18 '23 08:08 DimIsaev

wait

DimIsaev avatar Sep 18 '23 15:09 DimIsaev