HumanSignal / label-studio-ml-backend

Configs and boilerplates for Label Studio's Machine Learning backend
Apache License 2.0
534 stars 240 forks source link

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

Open juancalric opened 1 year ago

juancalric commented 1 year ago
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"
Babars7 commented 1 year ago

I have the same problem

DimIsaev commented 1 year ago

I have the same problem

shondle commented 1 year ago

Have you checked all of these settings?

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

DimIsaev commented 1 year ago

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
Francesko90 commented 1 year ago

Same problem

Francesko90 commented 1 year ago

I think that is related to #4493

Francesko90 commented 1 year ago

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

pritamfocal commented 1 year ago

Still having the same..

DimIsaev commented 1 year ago

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

shondle commented 1 year ago

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.

DimIsaev commented 1 year ago

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

DimIsaev commented 1 year ago

wait