Class: Logo::Suite

Inherits:
Object
  • Object
show all
Defined in:
lib/logo/suite.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(recognize) ⇒ Suite



6
7
8
# File 'lib/logo/suite.rb', line 6

def initialize(recognize)
  @recognize = recognize
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



4
5
6
# File 'lib/logo/suite.rb', line 4

def data
  @data
end

#recognizeObject

Returns the value of attribute recognize.



4
5
6
# File 'lib/logo/suite.rb', line 4

def recognize
  @recognize
end

Instance Method Details

#load(yml) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/logo/suite.rb', line 10

def load(yml)
  File.open(yml, 'r') do |file|
    @data = YAML.load(file)
  end

  prefix = File.dirname(yml)

  # item
  # => {"path"=>"test/suite/snap4train_raw/anhuiweishi/1370432428.jpg", "label"=>"anhuiweishi", "x"=>40, "y"=>45, "w"=>102, "h"=>78} 
  @data.each do |item|
    item['path'] = File.join(prefix, item['path'])
    @recognize.add_image(item)
  end

  @data
end