Commit b6aa62d8 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira

Merge branch 'sample_loader_as_transformer' into 'master'

CSVSampleLoaders as transformers

Closes #30

See merge request !60
parents 60cf9996 36ccaf35
Pipeline #46561 passed with stages
in 9 minutes and 23 seconds
include README.rst buildout.cfg version.txt requirements.txt
recursive-include doc *.rst *.png *.ico *.txt
recursive-include bob *.csv *.json
recursive-include bob *.csv *.json *.pgm *.pos
from .sample_loaders import CSVToSampleLoader, AnnotationsLoader
......@@ -9,10 +9,14 @@ Base mechanism that converts CSV lines to Samples
from bob.extension.download import find_element_in_tarball
from bob.pipelines import DelayedSample, Sample, SampleSet
import os
from abc import ABCMeta, abstractmethod
from sklearn.base import TransformerMixin, BaseEstimator
import csv
import functools
import bob.db.base
class CSVBaseSampleLoader(metaclass=ABCMeta):
class CSVToSampleLoader(TransformerMixin, BaseEstimator):
"""
Base class that converts the lines of a CSV file, like the one below to
:any:`bob.pipelines.DelayedSample` or :any:`bob.pipelines.SampleSet`
......@@ -36,9 +40,6 @@ class CSVBaseSampleLoader(metaclass=ABCMeta):
A python function that can be called parameterlessly, to load the
sample in question from whatever medium
metadata_loader:
A python function that transforms parts of a `row` in a more complex object (e.g. convert eyes annotations embedded in the CSV file to a python dict)
dataset_original_directory: str
Path of where data is stored
......@@ -48,47 +49,128 @@ class CSVBaseSampleLoader(metaclass=ABCMeta):
"""
def __init__(
self,
data_loader,
metadata_loader=None,
dataset_original_directory="",
extension="",
self, data_loader, dataset_original_directory="", extension="",
):
self.data_loader = data_loader
self.extension = extension
self.dataset_original_directory = dataset_original_directory
self.metadata_loader = metadata_loader
@abstractmethod
def __call__(self, filename):
pass
def fit(self, X, y=None):
return self
def _more_tags(self):
return {
"stateless": True,
"requires_fit": False,
}
def transform(self, X):
"""
Transform one CVS line to ONE :any:`bob.pipelines.DelayedSample`
Parameters
----------
X:
CSV File Object (open file)
"""
X.seek(0)
reader = csv.reader(X)
header = next(reader)
self.check_header(header)
return [self.convert_row_to_sample(row, header) for row in reader]
def check_header(self, header):
"""
A header should have at least "reference_id" AND "PATH"
"""
header = [h.lower() for h in header]
if not "reference_id" in header:
raise ValueError(
"The field `reference_id` is not available in your dataset."
)
if not "path" in header:
raise ValueError("The field `path` is not available in your dataset.")
@abstractmethod
def convert_row_to_sample(self, row, header):
pass
path = row[0]
reference_id = row[1]
kwargs = dict([[str(h).lower(), r] for h, r in zip(header[2:], row[2:])])
return DelayedSample(
functools.partial(
self.data_loader,
os.path.join(self.dataset_original_directory, path + self.extension),
),
key=path,
reference_id=reference_id,
**kwargs
)
class AnnotationsLoader(TransformerMixin, BaseEstimator):
"""
Metadata loader that loads annotations in the Idiap format using the function
:any:`bob.db.base.read_annotation_file`
Parameters
----------
def convert_samples_to_samplesets(
self, samples, group_by_reference_id=True, references=None
annotation_directory: str
Path where the annotations are store
annotation_extension: str
Extension of the annotations
annotation_type: str
Annotations type
"""
def __init__(
self,
annotation_directory=None,
annotation_extension=".json",
annotation_type="json",
):
if group_by_reference_id:
# Grouping sample sets
sample_sets = dict()
for s in samples:
if s.reference_id not in sample_sets:
sample_sets[s.reference_id] = (
SampleSet([s], parent=s)
if references is None
else SampleSet([s], parent=s, references=references)
)
else:
sample_sets[s.reference_id].append(s)
return list(sample_sets.values())
else:
return (
[SampleSet([s], parent=s) for s in samples]
if references is None
else [SampleSet([s], parent=s, references=references) for s in samples]
self.annotation_directory = annotation_directory
self.annotation_extension = annotation_extension
self.annotation_type = annotation_type
def transform(self, X):
if self.annotation_directory is None:
return None
annotated_samples = []
for x in X:
# since the file id is equal to the file name, we can simply use it
annotation_file = os.path.join(
self.annotation_directory, x.key + self.annotation_extension
)
annotated_samples.append(
DelayedSample(
x._load,
parent=x,
delayed_attributes=dict(
annotations=lambda: bob.db.base.read_annotation_file(
annotation_file, self.annotation_type
)
),
)
)
return annotated_samples
def fit(self, X, y=None):
return self
def _more_tags(self):
return {
"stateless": True,
"requires_fit": False,
}
P5
92 112
255
01-/19'*515<L[c_PKB6/12+.5=FTi^Qk_P97BVPJAG>T4JGC@XDGKB9=>4/2:<@B9.6BPPDGW@MBSM:.)+873886-4'.8-'/0('2,EFCH;343045@KQUbnkmeP]^L:QNSNHM<J=KOJ@]CEF532;73///==>/,@KN:BRQVIFD9/&''35423-2*33-(0,%$%,14+83/,.=HMOUdkoz{qoUPPSE>IdSVPILCEPWOUDH87/+-1+49@G;7/->PLPP[X^RF?64/)!130521.//2/*-(,==1A>=6CM=579@D>GapYqgQ^JIKK@K_`][POIDSRVVCK:5178557:A9:502>ZWY_\XZ[TOH9.'#++23../00,+,<62EHB?>0A96';JE@MTRXa\Z{_SDMEGHGM_ei\OXORVR\TNI:8=DLQU]S<.1/08=`VUZWRSFQQH@+."&)50/-03,#)18>8GDAC2$7+,6CGGGVZ]FCPRTtKQEQDOMSbpsXQfbTeXc^VL<AJ]\]^chZKA3;9<UTP@QHLEAE<5/'"!'+35-0.2!%*3<=D=<8:)"$'?UQ>:ELSHE9EUNZ^VEIPO\Xqyj`_sd\fYo[TF>J_ce]_a\aUGDG;?MWMDOH7:BDB5-.$# .50/1/7(64A<G;,+5$'+GQF?4<XSVKC9C\ZKb`VTVTeXrfcjpde]ju[QMEJUhshe]YSSVTNF;H]THG@;<A;1565*!%"310029%3>.07@2)$+"%.MaTBDV[SG\MDNIkVSgVaYfbikumpvnpa_pledZXQT`eehc[\\VPOG?DTFBC?>8>1<4<4@,$'-15.27)9.;G4<,,)%#(9U\GLNTOONRl_`agc][h[_efkprsvnq||wrh_VNR\ecc]SX[XIC?AQOH=8-85/2@<33=0'234017'.8Y17-3$#),66FH?FBOVbcbiqzzrnnbfmkpy~|ykj`\Xd`m[UU`YTNRLQSLI@=6,-68:0/.1'-2216.$29((<26+))*3M\QLN^dgny{x{{xxmja`dQPY]_RSMUVOK>DA.%+16=/(0$4,5/:%-01463>88+35=W`UU`nt}揭~xtjdTRRabPSKONMDJ;8=+/9&4C1.#.041;'1/,G63:8<>:GOe[Zkr|咿成孕戌底洛辰vZW]_d]OJHTJC<=4<9@=1*<63")27/@*10259=;9>FLVhf]tw~妍痕健疏足牯滬洵Zgd_]THXJD>>15>8N@5*:*3,0.53/;-3(@OB7=MYeqjq}{秣蓿牴犒洫號蕪遣僭尼i_\QXNYBDI6201BR;:)4( +*/188JII-'+850GOS_rz}硃蝶熙擠歇雪敷鷗羹鳩YT^_bNQUEHE3DEBAG(%'--/3EA@+Q9+1264:NWk}~孕振毽飲褪擘葆蛹融謄褽異_QXea]PQA8DE>?=7@&&"-102>25.N??3:6BUhr咿炭眼須鄞臏輕晰遞噢蜆滂葆痕坎fmlmn^WK=DD:D*8C+!',236.40*O:A@@4Mhw巨走洩陰絲章滓煽歲秩毀葩輓陶盔狀坎{{xjYXGJ^3'-*H;/&.00643.(=4BGBIGf{═╮物物庚音虞紫項雀乾控盛悌偺秧悄洮咻yi\QMEN*&%1;1,210>51'**59EBJKg戎坏╞岳庚降悖捲偉散眷乾掠秣陰偽秧鬼洫妞言ㄑi]LDFB6'(#-722/0<6(#&%9;MHNXlㄕ夾壯成戍狗垣停晰硫虞敦鬲秣洫陌鬼偺降祝洮洹豕見ZVDDH<+0)!7/231D1/"#038GFYXk|ㄖ扣貝丰版豕洮革盛陴陶雇掖祚限限拳痍祗悚赤岳豆戌aYCLO>362$,#,5-1<-)*6>8@RT[m夾型赤左洮物閂掘晴晰熄絨陴型悅神悅鬼祚重帚它岡奶lZHIHA2;5*"'-4,2;) &:2A9M[]bpㄗ妝帖物爭垠洎偽接葆溯僎順絞秣秤乾悔狎面悍咧言咧ㄑafJH@:9/0'9(*,/0=*$',-CAF^Zcq之帖牧囿咩洵乾偌鳥辣劃遜毀盔悖炫悚悔陋垢狎咿帘布e[QCVA;.*$A1$3-.12/)$/3BPQTcp帕咿足咧垂洫垣眾兢晴厭僎筑陌悅悅垣鬲重洮囿牧咧坐c^GHMVO5''(/-,0/32@#)-FBJR]fo尼之牧爭狙洩物革乾秩殿硫犖虞陪偽降垢洵降限帚陋牧爭戎gZD>IPF08&%!./2/.22#85JLJSX_m}不扣走咱帘帚帖岳洵掖犒僎須凳雯盛惚閂乾垂祗重洮酊洩爸均h\INBE3-01,/-/&3&*=6CCUX`bs岱左扣谷身狀悌貝城拿厭僱溢獐像散掠型秤祝秤神垓型重狀maSMM<*,*)$"/1-/*8!+22;DV^cl“言豆岳ㄗ狎秤洮悅做善撒劃撥虜陷絞筑悔炫降偃陌悅重物岸XRJB5)*&(&#*20076053??RXgj}成市岳爭扣扣牧妨狀秣源遢輒溝匱煽眼敢悖扇陋陋鬼掠陌神牧l_QVJ7).$)&#220.<;0+);ICY^jn谷巨成爸爬洵洵悄垢假蜓噢撚撬覬撥絨掖限狗為掖停祗偽陋祕均_VLBH3&**"%2//2C7*)%38J_hmv成夾豕帖囿物閂陋悔眷硃壁蝦酸謙懇遢捲祚偽悅悅停秣秣面悅坏^ZN555%8(*'22/-E/&%-*BLXkn尼豆爬物狎帖型閂秧控晴褐撢擬謎遙敞悟鬼祚炳炳扈陰秤祗洹_^UM;1'*'*#620.=2"+F)5@Pjt╞戌圻垣垣垠垠狎扇掖飯蜆鰻鐃蕙蝦遣粥祖洵祗秣秣偺戛掠洎咩`XFj9C)&&$.01-9?>R%2FXkt不丹帖狎降偺垣為做順酵擢鱉藩蕉兢扈高豕祖狗悖停盔悖痊郎eQRM663($&"/1.,.?-J 9MJeq丹洧洮秧悔陋面殿馭壇謄衡螃蕈撰神炙谷圻型幸祚秤停骨坎F_@1,+-,'.-1../7&!=*6TJ`’成夾洵帛洎陌秧陴滇蕞播螃撬蝴雇悍圻圾孕帖狙帕偃拳閉見NW92%.'2-,5-2124))43LD\丐壯垠帕垂扇偽眷絲遣撩遙凳項粥重咧丹之岳足圻垠高祝洶TZ73),-/0-4+0/57%2E4@8\妒妨爭咩狎帑皎眼毀順董捧斑敢重囿圻角失奶╮圾弛ㄙ狎aG/44%5-/11*1117.CNA6@Sㄒ═垠城炯結絕盒散雩痍妨圾丑O>-%2,45/1714034+!0_C)GK妒垂炭盛雲絨絮眶悟xxzyy0&&2D,06235.1525+_='LL}圻旨盛晰絞革陶悄炕ulkpwqw}0$#>C:2@412044/7!*X9-LPyuty|╯降眷殿筐扈祗u|H#-?676.M-11362:&%D@,IT洛秩斑普帛面悚幸飢V415828.D8,/1641<#H=TS悍炊予秦絢撰眼揪狎眷悔弛挈陞<A7617VVB)/16QdK%K.!RU祥毀祟}音馭擎掖陲岳帖炫qallAVCIOWv哄5JA1C}-+qQ@-+Qd溺撥\cYMJ`^l~捂爾結秘咩咯它見sqz{)I-vgT~5E<H{它,-均AGJl健漲wYY?bGdhr捎眷痕筑谷oQ_3sCcNqH@Oq_#畢kLy五陸e~JQ6Z[M]vy言◥挈恩雇迤新bfG帆id|Kc 漁M狐妓S瑣N\Zk垮忙雩葛xsx[wu\}妖PⅦ撐冉身眷蜌gcam}p言′噸蔬|w{y擎帛蜇央亢翮輔uy失尖#略p閂車爾丐′嶽楣s}除圾戛裸郃洎悸拿丹簞假x垠角奶洵捷僖孩悚坎ㄝ蜊繭爬奴ㄑ妥戚惕尼丐中戌迄閉炸紫臘咿央﹞平滇蔥砲爭═井咿悄‘╞丹Z}窄}祟q^物均洵鬥豕之岱托迨爸丐﹝戎尼弛Uzpv丹t帖角走炙言╮豕圻奴予韋重角不丰岱岫}祠u物炒丑戍予戍═丰’角壯物言成車眼悔予戎版帖式{陘y型壯孕它奶貝岫坐赤帘咿帘爸洸城祚悄角╪走版版郎}帚布炙牧左成戍妒限鬥牧言ㄖ陌陰悚咧﹜═丹岱帘咿咧弘惜帕為型為爬咱ㄔ圻垂玫散爬成妊陷結洵ㄓ丑﹝圻豆帚洧型咩nwb筆飢車秩挈拳帚咿帚赤赤身炭滂普眼神恩型╮ㄑ坎”赤豕洩洧洸岷楊洛<畢霰延眶挈盔帕狀悔帖型帑雩噸◤普掠洸牧皎巨ㄕ帚咿帚洮岱夾屆葛雅死w(耦池窖迪炤項偃拳型狐拳秤狎秧暑漯﹜朽絮揹祠貝偺泵壯赤足爸垂爭版孕萼央9-z薛挾溢紫痍盛拳停高祝停陬歲巨接陳痊版坐丰假洵郎身型牧悚豆狀見眼窠$.捫妒遙憚頃斯歲敢陷偃咿炫控散陳谷咧弗雄控祗炒﹞′鬲洫妒物偺扇洸垠咩═掖巧逢%/0'?雁眺撮接董僎須晰眼狙悌偺眷鬲為租痕襖楝偺爸車祚盔陋垢秦陪重重奶迂r9(..,#>萼咧眼毓輓熒蛹絮音悅戛秧悌成眺歇麥陷彌飪圻扇秤秤停租斐祚重咩ㄑ重:(,.,13$&r蝶拳控韌撥蕩噥雪捲掠悌垮重曳羹版並絞滷迭偽秧炯陷毀殿掠洮圾活{>)0.+,,5,/-'m偷薩絡絢壁蕉噪結結戚洵陌玻撕握^庚偌秧扈陶葆絡敢陵悄T<-,--++//10++'?z素章飭螟播犒熙陷皎垠秧’捧楝陬盛陴探陶給盛陵咿;9/-))/+-*+/0(.+0(+=H_健瑣鄘犖匱遘葆陰扇眸揭陷眼絞眶捧普晶熒捆牧岸(,*-)+*-++--*+-+++-(-, 疙瑪蕪蕪噶器撥敢敢革悵巧洧迄虞葆順健滓號兢雀牧哈 +,*,-+,--*.--)-*.,+.+風瑣噢藩藩謎僑敦斑祠妣炯雅═邢爾劃楹雀蜈晰葭陳悍<$(+,,,(*,+,/0*,,+,-+/(Lㄔ健遝壇藕舊翻僩雲盛神豕炭洶尼溯滓遜斯順煽溢揹悅&'-*&*/'.*,*,.,++,(,+(/-&丐炸遛螢飄擱擰遘順悅垂尼府爸◣掘蛹遣溯熙犖爾秣悖#'+*-'-'.&*.+1++.-+)+)-.妥遛藍齪藕擰撮盛足扣芍═ㄓ租物雪虞虞犒溢凳集惇恭:$+**).%(,)++&./-+,&+++*0j〞姘壁噥僚鬼咩帖夾見弛豕岡身陴歲硎凳犖滌捲悌)",+(-+%))/'.)/.-,)+'.,*,#H“炸蝗闡擎韌停悍秧洫洛坏五垮雀掩虞熄楝祚爸 &)'()+*%*-,,)2,++,*,.+*0,音撬謐噢雄韌蜓殿眾飢弛丹岱帛店乾眼陷僩撈雄鬥芍#($*%%+(((%+0(/,0/+(,+--).z′頂擱闡謗蕊蜈瑤蕃虜殿洸ㄑ戌狎為拿陰陷釩飪項結惚奴, &#,''(($()),)11/,0(--(*,. D托魚撬嬝講謎蝦蝦舊褽鼠垠捲捷斐絮陵偶韌陳悚忙'(*%$'*#**'(,*/1/,+.*0&,*--音講斂謊螟獄戚眺租停眼紫痍紫楛痊它$&&,$+(*$')&,(120./,,+(--+-a足蜈謝齬鷗擭艘ysk_bqponu~wxrrsqw}奏斯接普痊哈 (%*$-%%,$'&',*1.20)/+-,++-/+布滂撳藤藍葷tnuupihg`geb^UU]VTUQX^\[glr{絕探陷祗岷(''&*((''&')*,-251.0,).-)+.(e弧噬藕鷗龔籀x|vtrjpmmcg`cjddlrw眾陬秧重ㄑ!&'%((($+')&'++.3/3(3),*/()0,'蜀擬鼴警岷狎y{xvu|w{}挈結悔央!%%((($'&*$)()(212./0+0-,-+.))[玥蝦謊饑噫偽溯葉角悅捎陰悍芋!()&.('(-'((',15/0300//+*,)-(,遞螃蟹厊藪艘溯蕭僥岱狙洫探眸盛郎$(''0%.+)-#-(,24//52-/0)-.)*-*飪鄙賺薩虜鄙撓晰高奶辛為假筏盛惚#)"*%(+)+)),*-23.1-6-0//-,0+*.章壁薺翹獄蝨須毽雄悔早狀帚角﹞狀鬼斑偽垢悍 '&&)%'*)%)'2&/00/8+8.20021+-&/給謄鐘齪擠臘覬溢眾鬥岩帛拳洎夾辰秦偉揹洮囿&$)')&((*)),).212225012,022-./q陷蝙鏽撒螢謙鐘謙蝠敢祗ㄓ巧降鬼洎祚革振洸坏巨###$&'$*+&-',1*042040342-13//1-r掘遛驍翔臍蝗擰噶蕨陵恭貝妞垢垠秣捲祚洵物ㄕ"'"&&'&.',)-3+14411514..5/13.,m盛嗾撕螢擦蕭遞犖董祗坐坐尼帚帑限鬥咩物見#&%'((-'(.(.1(040433/2./2/+01.i控飭撕螟壁蕉爾雪陳泵不奴ㄓ尹市妞帖岳忖e&('+'(*&+(*..01414.6-1131//3/3d丰探遘播撒劂遠雲盔咻丐戍洸狎岸~&$)(-(-&',+//-02127,52304/05.5hㄖ奶為熄蓬蜓爾摒洮岸予巧弛e%%%&+))*,)(0.-150332700630904*l尹垠版妝偎蔑須撩筑圻坏圻奴h%!*%('&.**-+0/34105/4.0024505 rㄗ垓悍ㄡ像葡螂絡恩岱ㄔ式忖╮d$&'$%.#+'.+0+,014/21322005/7({炭雅酗秩溯噯葆貌坐孕爭岫失c&%$&&()'++/0-/-1/2215-1/4010 假毓敦坎振嗾蝨匱惜╡坎帚妨洛^'&%#'&+)..0/)4.62/30341062., 曲飧瑤陰咻陬獐劃粥洧岫不ㄐ╯妒尼忙{爸芍b'"('&&**/-.,01/1/4203/133'&狙絡遝熊疵扈項絮雯帘洧坏丑z足郃!)$%%*&--*2)01-4+40134./3+&%垮硫擦噶項成狐神玩酊郃版}狀陌岱c*&$#'++/*0-0-202.2/320.4#'狗雩蝗螢頃洶骨巧ㄖ貝坐式祝悔豕Y#)#()')..,-..-61.22/.2/-"'`重秤虜藕羹撕降鬥郊ㄑ仍洎悄.%%)'*+2-.//333-42/0.4"#'/'妒為章壅藕噯僑假陰泵悔垠洩式9*"',()1*,/..
\ No newline at end of file
10 12 10 120
\ No newline at end of file
P5
92 112
255
<<>503=<GDNHGJNXXMS\_drzw~toihgfN@@N[<2=VKJ7$(5.:I6?>E==EEGUY[TVPLQan扛qphon^HIKXN-<FM0A("23DMPC9BBAMQX_X`\fU_kx宏遙戍sppokYS@[O25JQ028$21OL8>@@=JPT\afnefjs~丑夾暫蝶痕岫wrnojYG_X67Z?06N'-31ED?OQRIKMgkpmmv}夾悖恭╯它壯布底嗽岒蝠漁秧ppijMQQ0?P>$/[0.1+AYODPWWX[forz}往頂噬陋骨貝洹妨版底韭葭酸蕈葩煽洽qoiX:V.LND'-V21+4>CGRYadmzy}ㄕ妝揚瑰謎歇蔡絨妞帖貝祗眾絲蝠遣虞眾隋角sniED:LQ;48@80147HNT]iitz~尼庚陋滂蝠匱撰集秤盔炫捲斑熔普陰敦垮奴ㄓpoXG<FE;777/1-8?GDX[bklxㄔㄐ尹丹郃悖頁爾虜停限降秣降扇陌措惇垢洫迫ㄓ丰qdTP=MI3+A,12HABQW^bgu丰ㄑㄔ成帖帛辰絡斑陶扈悖炳扈洎閂秤祟洵狎豆﹞╮pwdKIV7"E<73D=FTT]jpz╯中忖扣牧洵郃楛閉陌陌秦祚垮赤垢炫垣帚悚物豆WFS=*;A0.MHDNY^jf}‘奴戍豆帖洮陸偺紫帖悖祚戛悌悚垂足陋咿赤爬谷孕GN>'05.0IECR\c_pyㄐㄖ╯豆岳垠拳乾悖陶悌戛戛型洸郎洮物牧閂夾爸坏貝奴XAU/06/.DAIPYVgty╪它夾帘垠假韭散飧韭敦悔洧悄帘帚泵妞狀戎成戎孕見╰GVF2//.CQS[[glnz{═中╯丹妝赤洵為陴普萵眷斯戛悌城乾垣酊咧洮咩成咿豕ㄑ丐WLG>01,KW^fe_lkn|═角之弛妝五赤閂閂偃散殿陷散葩控控盔面悟炫戚垂岫咩圻RQL/23/GMOZca`hs~~奶孕╞忖坎赤型洫為偃普葆葩韌斐盛粥敢秧戚神悚咧妒妒言“﹛T]934/QOVSYW^hnr|戌圾豆爭丹惚限牧秣虞普撒葭熒敞秤扇祝炫悅垣洧扣戍岩岸屆KTR+:/DTGIQZWgmzpz坏戌夾收洮仍限帛帚捂散蜓犒號殿眷鬼惚走悌祗垢尼咧收妝角‘TIH35.PCDNU]^iinwy圾赤岱帖帛酋城牧契拳結虜兢葩散控偺陵狎型悔爸收悄奶托忙]TD56-LJVM\^^\djy丹谷◥垂谷帕洧陋巨偽炸董蓿蔆斯陷秣雯惇祖酋限洵版帘忖成坏﹞╮M_5-1WMNQ]\`fpn坏洵貝帕悍帘郃垣息郃炫絕毽蕨撙兢楛絨戛囿悖閂洩咿型牧戎戎忖丐RP7(6@MMSU_ikoy}物洵身帚型酋重骨走骨偽偃竟溯凳劂掠敦惇酊收悍悌重帕狙ㄘ尼ㄓQa6'1SWN\Z_hnov~囿限帕豆爸版牧悍陋神偺斑劃溯蝴撮雪皎洎祖貝洎垠酊足夾岫左式ㄓQ]B++]YX\g`dkoz}悔降重爸洵帖布悅炬降絞紫劃遞遜遣結陵垠狙鬼型爸牧陋帘岱戍圾咿中﹜^SJ(5\Yaknifnt{垂陋高悍陋洩限悖革雅陷捧普撮遛噶劃炭悖限陬限囿帛骨囿帖圻豆市中TB0,Ragpfryz~平酊悚洎物垠身限悍做炫雁僕輓擎劂遝歇偌閂重酋洧洵妞洧妒坏妝岡岸戎丐WF/-S\jkly岫型妞囿版垂走洫祗扇陴毀犒煽螟爾遝董散偺洵洩帛谷帚悚豕坐妒角帘成戍不UB0/RZ`kvu}|牧物版妒帚夾夾閂玩面秘溯蛹器厭謗遛噪竟炳祖祝貝酋帖車妝走尼圻戌豕成咯aY:2-USYj|{t帕豕咿夾谷扣成赤洫偺閉陶絰撓熒蛹職蕩晴盒悖祚陋狎牧岳酊咯坐“不不尹丐T31/VU[qow帖垂予戍咱﹝岫豆狀陌韋的撞溢溶葭劂戴雇斯掠盛洮垣垠垂型咿咯不╰╮失尼﹛C4-1OSalgj物垠左角忖咫﹞豕見貝帛捲景螂毽晴韌飩撲雯秧揚秣悌辛郃爸閂之咩ㄕ﹜奶412.VS``lw閂夾物戍戎它夾咻帘做飲僎斐假戛秩乾鬼悖洮惇陋狎咧帖牧ㄘ岳妒╰﹝7-.0LSR^n酋爭岫戎ㄓ不丹它孕扣陌挾悅爭扣岩孕丹狀妨帕洮陌洩妝限足洧豕洹a+112LRP]}咯貝爭ㄑ不╡巧豕戎爸洎限酋赤囿陌秧炊托+-4+SKJe爬之豆奶豆均扣洎版咿洮革盛祖酊zxxxzv*..VJNj坏奶忖壯{y{||平限酊恥音結洹upipuvnv|y'.1VONz丹孕uoqw|{市妖限偌陽xwujruz||w~{l4+0bO]z巨╞豕悅豕之面爸|l3*/OK^ㄓ╯╡爸痕炊角帕祟4(-QRj巨ㄔ╪奴弛﹜﹛芋云牧盛釣rifomz弛&/.TVo奴ㄖ赤酋洹粥妤活mdX[`[qx|zz挾盔陸站撕迨q]<LPJKC(fcVYs=(+/\Yuㄐ成豕秤垣晷戴秧息fdURS3NwhPN^_Xiqqor斂噹悅智雇岡nOc袁4`*n0Fz5(./]g{戎之洎秦歇黑蔣qMH>Qu3`1]gRci_hvrr彼酵雁停飲歲畦x|APoR&\2m畢4L,'1/cj坐扣車做獐獄楨eoBV 17\8jbgcpnt眺雅陳盲蔥勳Rb_B?>bHs5!02uy戍左垣晰撚擱孺eRiTUDUUMuxpay租結恕翕蜈憤`^硯TaS:xkps0&1/ㄗ妣陌斐遛謝zp^dN[wwnmim托乾咱阱歇躓另gjs}ib`zho9"1/圾爸鬼眾絲蓿vuspqsupv帖洸╯撫屁鼎q{~wy}wcv>',,炙谷鬲偽盛秣ystrz{z|版帖簞奏炙vps{~|}vy$-)ㄘ奶狙偺眷洮丹wuzz}|岩岱丑兮陲悍nsy失%,,巧爭炳盒鬲咫狐葬~~收咱巨0冀悟rtx}悚,1妒垂鬲陴祖孕足陸岱它洩丰陽之不u&&1戌物悔垢鬲岱═巨帖貝丑﹞ㄓ垠爸郊﹜ㄒx5!1忙岩閂垢洫重巨ㄐ═它丹谷﹞戌中ㄕ岳妒版忙咿╪|~.%+戌物重悖洵悅物坎‘不戍岸忖互帘咱咩炙奶巨酋貝1&1ㄑ型垂祠祖閂垠岱坐﹞丰壯忙赤ㄓ予夾咿洵爸巧不尹神炫*,*忙洮洵垢型垣帛豆尼╡弛圻扛炫洶╯丹圻岸赤云垠洵洩ㄙ它型悚悍'(3尼為妝垣惚重版谷岱成五收祖左岡岱ㄔ壯垂酊扇帑云型爭巧限車谷%(*云垂洮拳酋馬言帖成戍幸版恕失戎圻中圻帛偽盛狎悄洸弛洎牧+/╡妒帚閂扈隻垂岫咿咯戍帘扛旭戍坐尼扣予豕予炫眾斑岱岳扣忖眼悚恣%*-巧走爬垣陷祖洮狙悄豕巧巧圾成豕扛爭悄洸豕妨谷帖盛高丑奴敢悔洶'(1╪咿洮狙陬痕神閂閉酊咿貝失坐走妞洶走郊咿扛成洎悔捕悖悟&).〝垠重玨眷葛做悖悅帘帖言ㄑ忖布炫悚版郎郃帘妝岳之奶◣犒敞惇&*.◤神限玩眷殿虜眷悌郊洸扣尼壯妙限悔高爭垂爬豕ㄓ丰﹜奎楛偽爬ㄓ<',)ㄜ高秧韋陷兢蛹熄掖鬲版妞垂狙重神重垠牧岱言﹝╞╯底痊幸早貝╯/$,.足炳為音捲須獄遣探陰假重限城酊悟爭赤狗洛╰狀豕岳℅滬足牧洶’''+/井祚面炤晶絡溢蜈眸陬眼降秤洵鬲洎弛岳岱岩不╰不帑絞溶像坅狀物惕角╮央 &--走挈炳拿絡僎爾遘輓毓葭眷盒悅鬲鬼尹洛豕咱丹鬼韋章紫敵玩角捲岱戍奴!(),左悖悌盒陷毽嗾陷溯晴韌捲陰祚鬲惟壯洩市給遢撰眸垓飭洩〣咩豕岷7"&,(壯洫陳挾偌像劃熊僱葆葭雀散控悖成坐咫奶弦凳x肅絞垠洧uw閂帘爸ㄑ,!(-.坏辰雄偃雀順飯劂熒溢匱溶斐盒眷物戌圾高葛陌u祗爸孕!((.+失身陳拿窄章溶嗾獄兢遞蛹歲粥祖疵ㄖ圾扛祠v鬥kz悌豕中&,,+中貝炫炬偃蛹凳飩厭撩蝶虜僕扇祝限豆岫狙惇拿悄ej狗鬲悄豆%*&.╯洎妣炯捲獐遘僩遢噯噶犒董結盔洫帘炙丑它洫垣祗垠gn庚秦扣悔忙- ',).ㄐ妒ㄚ停紫善熊爾劃蝦噢噱辣絨絨祚垂岷孕垣偺夾炫岱坎uv狐陶尼帛n*!))(&它狙葩斯溢虜遞遙遙蕩瑰陰雀陵祖咩它足扇祚妞坏丐旬停帚爭炎^$,-*'奶扛挾雪眺絰遣蕞播噢蝨蔆項盛祚物帕陌扇惚泵岩央ㄕ身悅祝妝言B!$&*-'ㄗ早陬結絮遘劂擎蝨擰蝨撕換悔閂限降革洵谷◢丹’﹞閂帕悄豕5$%'))﹞仁陶萱毓犒翔蝗蝓擭謙蕩雅乾降停祚走”咱‘﹝ㄓㄐ岩托帚岡! %)')$╪炳秘斯蛹僎撬蝨蝙藏蝶熄雅拳偽偽版炒貝言豆爭岷岡戍爭%''*&熔延陌雲飧辣馭遛鄞藏噥僎陳陰盔戛酊帘郎貝咿閂咯圾它爭[&&)(&&滓粥秣秧匱撥播螟蝨擰辣董眼偉假咩走足洮狀限限戚ㄐ╯忙﹝洶&(')&(蛹停陋虜瑤噬蕪講謗戲遠絨歲歲疵ㄓ洮牧乾悚垠掖恐ㄓ奶丰/&)'&&#絳妣眷偶爾噬遝擬藩噱虜輔晴絮盔咫洮祖面陶祖悅角’丹岩k#$&&'")暑應控控溢撫擊藝臏蕩輒匱革凳斐神帛囿豕偃雅炊角赤中"&*!&%'笆蕭痍陷絡劃票螢鐘蝓懦溝硫遣萼鬼型’zvrqlu{wnmoorqrptrru“岩>($(#)$(韭噯帑降晰厭鳥擬謐壁謎蜈蜈撒結閂恩sld]XSVTXXY]VMRVRSOPY`acgx)&*('$)&撫髡垮窈毓撙數鰾謝講犖瑣嗾蝴祝牧e_ffkfeb^dcnkuonjccXf^^ZSUSVTU_ix忙")"(+$'(z偵獐亢炯虞遛藍鰻螃醴覬撕瑪遢揮坏vuoqnxvxyx}{yvwqxxiigmcogelpw5#("&%#&+`窄蝨鼎版垓溯壅齪齪齪螃蕪蝸蝴僎丰{px|x{{y{!( &$%$#'H幸蜇輕咱玫暑谿薰謊螃遞毽筐ㄑ~~"!$#$&%%%2弘絳辣給撢曖藷擠蝙遘萵惚咱丐豕型韋祚)' #$&%$(7偵蝴陽奶捕黍臏鏽躉翹遛雲皎祗圻◥ㄘ弧滲痔夾$#&""'&):偉撫陴#狠溥臍藍覬撓輓殿庚鬲貝丹丹垮骨囿息不弛+""!#"&"(&&(絕飲像赤偵瑪螃藕躂蝨螂絮絞降限坏戌巧物谷咿中ㄕ═=" # % '%$%&'q偌毓蜇溢狀滓絰螟擭鰻撚韌眶悅敞重帚豆豕牧═岸奶% &&$%$'&''`掖斯飩蜓捶垮雪撩擦融擊熒扈洸偺盒息洸重帚咩托它╮1%#$!&'&(&%#V炯紫硎犒葩ㄞ捲凳蕃壁器煽陴坎足悖鬲閂垢赤洸垂!!#"##"$%&&%I狐拿雯撩凳哄幼韭捱遙蔆歲探惆﹝狀垂垂帚帘尹岳圾﹛*# $'#!#' $#C妍陬須蜈劂骨═身挈斐撞控悔牧谷妒帘岸岳ㄔㄔ╮╰﹛5$%!!"!!'"#$2豕陴滓毽噪集角炕◢妣閉雩拳陪岡芋ㄐ╡夾帘$# '"!"$$&%%""-之偽給趕遝熄悄爭丑′咿捕皎閉丰孕ㄒ妞!!""# """ ""$$%%)之偽絲凳劂噤疵郁戍﹝ㄙ降風炫$$#" " &#"%%.◢秤雩虞蕭遘筑祟妨失╮爸型陪郁"!&%!!!!%$$( 8ㄓ悅晴熒職噫熊乾帘迤戌收結迤$#&&!!! "!$#$
L﹝狐順犖噢蝴撩筏走岫岷﹛悚玥失迨1'##! $$"" a妤掘飩撚覬劃僭牧戌尹﹛壯悸岳物z= '##! # "#!%!|辰陶虜嗾遛獄爾雄足ㄕ弛妣垂坐不孕%("%#% $%辛捲蜇遞噢謊撮雯悸之恕╯庚:
#'&! ! $' #$垂絲號遜蜓臍噢號絞妒派’巧’ㄐv2 )! ("!!扣降韌蓬撫擠謠噯撒閉悌帑ㄗ{{.'&! ""$$ o豕悖眸絰號罈蝙墾號蕨尼掖麂垠丐{~ "+#!% ""
\ No newline at end of file
101 121 101 1201
\ No newline at end of file
PATH,REFERENCE_ID,GENDER,AGE
1,001,M,104
2,001,M,110
\ No newline at end of file
from bob.pipelines.datasets import CSVToSampleLoader, AnnotationsLoader
import pkg_resources
import bob.io.base
import bob.io.image
import os
import numpy as np
from sklearn.pipeline import make_pipeline
def test_sample_loader():
path = pkg_resources.resource_filename(__name__, os.path.join("data", "samples"))
sample_loader = CSVToSampleLoader(
data_loader=bob.io.base.load, dataset_original_directory=path, extension=".pgm"
)
f = open(os.path.join(path, "samples.csv"))
samples = sample_loader.transform(f)
assert len(samples) == 2
assert np.alltrue([s.data.shape == (112, 92) for s in samples])
def test_annotations_loader():
path = pkg_resources.resource_filename(__name__, os.path.join("data", "samples"))
csv_sample_loader = CSVToSampleLoader(
data_loader=bob.io.base.load, dataset_original_directory=path, extension=".pgm"
)
annotation_loader = AnnotationsLoader(
annotation_directory=path,
annotation_extension=".pos",
annotation_type="eyecenter",
)
sample_loader = make_pipeline(csv_sample_loader, annotation_loader)
f = open(os.path.join(path, "samples.csv"))
samples = sample_loader.transform(f)
assert len(samples) == 2
assert np.alltrue([s.data.shape == (112, 92) for s in samples])
assert np.alltrue([isinstance(s.annotations, dict) for s in samples])
......@@ -27,6 +27,7 @@ requirements:
# bob dependencies
- bob.extension
- bob.io.base
- bob.db.base
# other libraries
- numpy {{ numpy }}
- dask {{ dask }}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment