class_docstr: CSVReader supports reading annotations out of a CSV file.
  
  The reader requires the following directory structure within `data_dir`:
  * Annotation data (bounding boxes) per split, under the name `{split}.csv`
    on the root directory.
  * Dataset images per split, under the `{split}/` directory on the root
    directory.
  
  Thus, a CSV dataset directory structure may look as follows::
  
      .
      ├── train
      │   ├── image_1.jpg
      │   ├── image_2.jpg
      │   └── image_3.jpg
      ├── val
      │   ├── image_4.jpg
      │   ├── image_5.jpg
      │   └── image_6.jpg
      ├── train.csv
      └── val.csv
  
  The CSV file itself must have the following format::
  
      image_id,xmin,ymin,xmax,ymax,label
      image_1.jpg,26,594,86,617,cat
      image_1.jpg,599,528,612,541,car
      image_2.jpg,393,477,430,552,dog
  
  You can skip the header by overriding the `headers` parameter, in which
  case the `columns` option will be used (specified as either a string or a
  comma-separated list of fields). If this is done, the above six columns
  *must* be present. Extra columns will be ignored.
class_docstr_tok: ["CSVReader","supports","reading","annotations","out","of","a","CSV","file",".","The","reader","requires","the","following","directory","structure","within","`","data_dir","`",":","*","Annotation","data","(","bounding","boxes",")","per","split",",","under","the","name","`","{","split","}",".csv","`","on","the","root","directory",".","*","Dataset","images","per","split",",","under","the","`","{","split","}","\/","`","directory","on","the","root","directory",".","Thus",",","a","CSV","dataset","directory","structure","may","look","as","follows",":",":",".","\u251c\u2500\u2500","train","\u2502","\u251c\u2500\u2500","image_1.jpg","\u2502","\u251c\u2500\u2500","image_2.jpg","\u2502","\u2514\u2500\u2500","image_3.jpg","\u251c\u2500\u2500","val","\u2502","\u251c\u2500\u2500","image_4.jpg","\u2502","\u251c\u2500\u2500","image_5.jpg","\u2502","\u2514\u2500\u2500","image_6.jpg","\u251c\u2500\u2500","train.csv","\u2514\u2500\u2500","val.csv","The","CSV","file","itself","must","have","the","following","format",":",":","image_id",",","xmin",",","ymin",",","xmax",",","ymax",",","label","image_1.jpg,26,594,86,617",",","cat","image_1.jpg,599,528,612,541",",","car","image_2.jpg,393,477,430,552",",","dog","You","can","skip","the","header","by","overriding","the","`","headers","`","parameter",",","in","which","case","the","`","columns","`","option","will","be","used","(","specified","as","either","a","string","or","a","comma-separated","list","of","fields",")",".","If","this","is","done",",","the","above","six","columns","*","must","*","be","present",".","Extra","columns","will","be","ignored","."]
docstr: Checks whether the CSV has all the necessary columns.
  
  The actual check is done on the first row only, once the CSV has been
  finally opened and read.
docstr_tok: ["Checks","whether","the","CSV","has","all","the","necessary","columns",".","The","actual","check","is","done","on","the","first","row","only",",","once","the","CSV","has","been","finally","opened","and","read","."]
code: def _check_csv(self, row):
      """Checks whether the CSV has all the necessary columns.
  
      The actual check is done on the first row only, once the CSV has been
      finally opened and read.
      """
      if not self._csv_checked:
          missing_keys = self._column_names - set(row.keys())
          if missing_keys:
              raise InvalidDataDirectory(
                  "Columns missing from CSV: {}".format(missing_keys)
              )
          self._csv_checked = True
  
file_path: luminoth/luminoth/tools/dataset/readers/object_detection/csv_reader.py
imports: import csv
  import os
  import six
  import tensorflow
  from PIL import Image
  from luminoth.tools.dataset.readers import InvalidDataDirectory
  from luminoth.tools.dataset.readers.object_detection import ObjectDetectionReader
  from luminoth.utils.config import is_basestring
  from luminoth.utils.dataset import read_image
label_desc: Use image node_id 6 for calling the CSVReader obj's underlying member method code with example usage: obj._check_csv(row) without return types