title: YOLO: Wrong annotation: class_id = 6. But class_id should be [from 0 to 0]
body: <p>I'm trying to train YOLO for object detection based on 8 classes by using Darknet. However, while training I receive the error</p>
  <pre><code>Wrong annotation: class_id = 4. But class_id should be [from 0 to 0], file: data/obj/images/IMG_8943.txt
  </code></pre>
  <p><code>IMG_8943.txt</code> is one of my text files where I store my annotations which have been obtained with labelImg. I don't really understand why I'm getting this error since I have specified the number of classes within my config file:</p>
  <pre><code>[net]
  # Testing
  batch=8
  subdivisions=1
  # Training
  batch=64
  subdivisions=166
  classes = 8
  width=416
  height=416
  #filters = 39
  channels=3
  momentum=0.9
  decay=0.0005
  angle=0
  saturation = 1.5
  exposure = 1.5
  hue=.1
  
  learning_rate=0.001
  burn_in=1000
  max_batches = 4000
  policy=steps
  steps=400000,450000
  scales=.1,.1
  
  [convolutional]
  batch_normalize=1
  filters=32
  size=3
  stride=1
  pad=1
  activation=leaky
  
  # Downsample
  
  [convolutional]
  batch_normalize=1
  filters=64
  size=3
  stride=2
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=32
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=64
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  # Downsample
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=3
  stride=2
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=64
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=64
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  # Downsample
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=3
  stride=2
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  # Downsample
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=3
  stride=2
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  # Downsample
  
  [convolutional]
  batch_normalize=1
  filters=1024
  size=3
  stride=2
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=1024
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=1024
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=1024
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=1024
  size=3
  stride=1
  pad=1
  activation=leaky
  
  [shortcut]
  from=-3
  activation=linear
  
  ######################
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  size=3
  stride=1
  pad=1
  filters=1024
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  size=3
  stride=1
  pad=1
  filters=1024
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=512
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  size=3
  stride=1
  pad=1
  filters=1024
  activation=leaky
  
  [convolutional]
  size=1
  stride=1
  pad=1
  filters=18
  activation=linear
  
  
  [yolo]
  mask = 6,7,8
  anchors = 10,13,  16,30,  33,23,  30,61,  62,45,  59,119,  116,90,  156,198,  373,326
  classes=1
  num=9
  jitter=.3
  ignore_thresh = .7
  truth_thresh = 1
  random=1
  
  
  [route]
  layers = -4
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [upsample]
  stride=2
  
  [route]
  layers = -1, 61
  
  
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  size=3
  stride=1
  pad=1
  filters=512
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  size=3
  stride=1
  pad=1
  filters=512
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=256
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  size=3
  stride=1
  pad=1
  filters=512
  activation=leaky
  
  [convolutional]
  size=1
  stride=1
  pad=1
  filters=18
  activation=linear
  
  
  [yolo]
  mask = 3,4,5
  anchors = 10,13,  16,30,  33,23,  30,61,  62,45,  59,119,  116,90,  156,198,  373,326
  classes=1
  num=9
  jitter=.3
  ignore_thresh = .7
  truth_thresh = 1
  random=1
  
  
  
  [route]
  layers = -4
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [upsample]
  stride=2
  
  [route]
  layers = -1, 36
  
  
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  size=3
  stride=1
  pad=1
  filters=256
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  size=3
  stride=1
  pad=1
  filters=256
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  filters=128
  size=1
  stride=1
  pad=1
  activation=leaky
  
  [convolutional]
  batch_normalize=1
  size=3
  stride=1
  pad=1
  filters=256
  activation=leaky
  
  [convolutional]
  size=1
  stride=1
  pad=1
  filters=18
  activation=linear
  
  
  [yolo]
  mask = 0,1,2
  anchors = 10,13,  16,30,  33,23,  30,61,  62,45,  59,119,  116,90,  156,198,  373,326
  classes=1
  num=9
  jitter=.3
  ignore_thresh = .7
  truth_thresh = 1
  random=1
  </code></pre>
  <p>Furthermore, I have used the following commands to set up  object names:</p>
  <pre><code>!echo -e 'classes= 1\ntrain  = data/train.txt\nvalid  = data/test.txt\nnames = data/obj.names\nbackup = /mydrive/yolov32' &gt; data/obj.data
  </code></pre>
  <p>Can anybody give me a hint what's missing?</p>