csv-reader
              
                 
                
            
          copied
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			Readme
Files and versions
Updated 3 years ago
data-source
csv reader
author: junjie.jiang
Desription
Wrapper of python csv: https://docs.python.org/3.8/library/csv.html
The parameters are consistent with csv.reader
Code Example
Example
from towhee import DataLoader, pipe, ops
p = (
    pipe.input('image_path')
    .map('image_path', 'image', ops.image_decode.cv2())
    .map('image', 'vec', ops.image_embedding.timm(model_name='resnet50'))
    .output('vec')
)
# csv data format: id,image_path,label
for data in DataLoader(ops.data_source.csv_reader('./reverse_image_search.csv'), parser=lambda x: x[1]):
    print(p(data).to_list(kv_format=True))
# batch
for data in DataLoader(ops.data_source.csv_reader('./reverse_image_search.csv'), parser=lambda x: x[1], batch_size=10):
    p.batch(data)
Parameters:
f_path: str
csv file path
|  | 4 Commits | ||
|---|---|---|---|
|  | 
												1.1 KiB
											 | 3 years ago | |
|  | 
												851 B
											 | 3 years ago | |
|  | 
												100 B
											 | 3 years ago | |
|  | 
												557 B
											 | 3 years ago | |
