HumanSignal / label-studio-ml-backend

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

ML backend returned empty prediction for project #434

Open jehanjen opened 8 months ago

jehanjen commented 8 months ago

hello, i try to connect label studio with ML backend,with out modify model.py, but i dont have any result and i got this error( ML backend returned empty prediction for project )

DimIsaev commented 7 months ago

project is dead

ejboomus commented 7 months ago

I am still having this issue. The bug fix did not work for me, did it work for yall?

DimIsaev commented 7 months ago

You need to select one of the examples in the examples directory

The default project is usually empty

https://labelstud.io/guide/ml.html

ejboomus commented 7 months ago

You need to select one of the examples in the examples directory

The default project is usually empty

https://labelstud.io/guide/ml.html

Sorry, I meant in regards to the SAM model. I have labeled 3 images (with the SAM model's help), clicked start training, and now wish to pre annotate the rest, but the docker log states there are empty predictions.

niklub commented 7 months ago

@ejboomus have you tried to install SAM from the latest master? Following the guide :

cd label_studio_ml/examples/segment_anything_model
docker-compose up

and with the labeling configuration

<View>
  <Style>
    .main {
      font-family: Arial, sans-serif;
      background-color: #f5f5f5;
      margin: 0;
      padding: 20px;
    }

    .container {
      display: flex;
      justify-content: space-between;
      margin-bottom: 20px;
    }

    .column {
      flex: 1;
      padding: 10px;
      background-color: #fff;
      border-radius: 5px;
      box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
      text-align: center;
    }

    .column .title {
      margin: 0;
      color: #333;
    }

    .column .label {
      margin-top: 10px;
      padding: 10px;
      background-color: #f9f9f9;
      border-radius: 3px;
    }

    .image-container {
      width: 100%;
      height: 300px;
      background-color: #ddd;
      border-radius: 5px;
    }

    .text-adv {
      background-color: white;
      border: 2px solid #000;  # Add border
      border-radius: 15px;  # Increase border radius
      box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
      padding: 30px;  # Increase padding
      font-family: 'Arial', sans-serif;  # Change font type
      line-height: 1.6;
      font-size: 16px;
      text-align: center;  # Center align text
   }
  </Style>
  <View className="main">
    <View className="container">
      <View className="column">
        <View className="title">Choose Label</View>
        <View className="label">
          <BrushLabels name="tag" toName="image">
            <Label value="Foreground" background="#FF0000" />
            <Label value="Background" background="#0d14d3" />
          </BrushLabels>
        </View>
      </View>
      <View className="column">
        <View className="title">Use Keypoint</View>
        <View className="label">
          <KeyPointLabels name="tag2" toName="image" smart="true">
            <Label value="Foreground" smart="true" background="#000000" showInline="true" />
            <Label value="Background" smart="true" background="#000000" showInline="true" />
          </KeyPointLabels>
        </View>
      </View>
      <View className="column">
        <View className="title">Use Rectangle</View>
        <View className="label">
          <RectangleLabels name="tag3" toName="image" smart="true">
            <Label value="Foreground" background="#000000" showInline="true" />
            <Label value="Background" background="#000000" showInline="true" />
          </RectangleLabels>
        </View>
      </View>
    </View>
    <View className="text-adv">
      <HyperText name="title" value="Use &lt;a href='https://github.com/HumanSignal/label-studio-ml-backend/tree/master/label_studio_ml/examples/segment_anything_model' target='_blank' rel='noopener noreferrer' &gt;SegmentAnything model &lt;/a&gt; with this template." clickableLinks="true" inline="true"/>
    </View>
    <View className="image-container">
      <Image name="image" value="$image" zoom="true" zoomControl="true" />
    </View>
  </View>
</View>

<!-- { "data": {
  "image": "/static/templates/segment-anything.png"
} }
-->

Don't forget to enable Interactive preannotations mode:

image

and this "Auto-Annotation" toggle in the labeling in UI:

image

Hope this helps, let me know if you encounter any problems.

By the way,

...clicked start training...

SegmentAnything doesn't support retraining, but works as generic object segmentation out of the box, so no start training action is needed.