我正在为即将到来的项目使用LabelBox进行图像注释和标记。我正在遵循 LabelBox 教程,将 export.json 转换为TFRecord。
我的代码段:
import json
tfrecord_paths = json.load('./export.json')['"gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7pxl6r3hx0d3351zn38ae.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6luh8que50d33x3wps35m.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7pahar3b80d333c1trilh.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7ohv2r3280d33df8c1npo.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7ngcmr2rc0d33azbifckb.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7mwlpr2mt0d33oseorjrb.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7m2slszc6081346kdhjuv.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7lk8yr2dy0d338b9c5sir.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7kw9wr28n0d33u7k8s508.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7kc1cr21c0d33blomz3rr.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7joowr1v60d33zdj992nk.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7invdr1ln0d33jialkrca.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7iaw0r1gl0d33l8qtuvbx.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7hr01r1a90d33mh4ey6c4.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7h5vlr15a0d33cspzs8ec.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7gmb2r11c0d3366mddgv7.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7ftcir0qs0d335n8qtgro.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7cz3pqzrr0d33d58ka0jh.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7cfqwqzk30d33xxmd2qly.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7a10pqyxy0d335byj15yz.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng798iwqymf0d332uxr6yn0.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng78gkvqyag0d33k6oewyl2.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng77jf4qxxa0d33ij4ysiv9.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng76ja1qxpt0d33i8qjdhuh.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6x7b5qwfs0d33y5rm5dvx.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6wzy6qwdj0d3369tcjy66.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6wv8cqwc80d33skmptn56.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6vvryqw4m0d33lthmmmc4.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6vdioqw1x0d33g5mowuhs.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6usezqvym0d33fpjaj8ns.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6u81xqvwp0d33g8hw09bj.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6t2ewqvs90d33yy28e8dd.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6st7aqvr50d33zpvxnk95.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6rrn1qvl50d339zzy290r.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6pngyqv8k0d333d6unjav.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6mt5vquma0d33ot8ikfij.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng7qpk4r3ra0d33jw2qth9l.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6ky96qu640d33gk7w6m95.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6k3fcqtor0d33ywbsadge.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6jaa4qtbu0d33erynqglq.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6j6ipqtay0d33d9m0s170.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6j34bqt8o0d33paf4t28j.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6iyjxqt690d3399qi19y4.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6it3vqt4q0d336i0lp0i8.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6hujrqsr80d335huc63do.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6h459qsk40d332dx3q5t1.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6e1ipqrob0d333j6onvvx.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6d88hqrji0d33f48zbazj.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6cecdqred0d33ut1eh0do.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6bmilqrb10d33lo4xs7r9.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6atqtqr6k0d33pnakui4u.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng6a440qr3f0d33hw84l66j.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng68u24qqy50d33wtju9u4q.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng67du8qqt80d33dlhmnush.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng66ywyqqrp0d337zfyywxq.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng65lvjqqgw0d33k2x6cvr6.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng64tt4qqbj0d33bo5itc3x.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4k6x3qj7l0d33rpo02nsy.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4im5tqit60d33c7cts2s4.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4haumsr1808130g9bpftc.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4gnm6qic80d33zpsjxu0j.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4fxyuqi3o0d33tu4fhwf7.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4fa8vqhwp0d33asgvrcic.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4f2ebqhv00d33fom2jsam.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4e08jqhkz0d3336240xbs.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4cc9oqh7k0d33qnphuhyz.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4bewnqh0o0d33ueltn54c.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4admjqgu60d33v2wm1g31.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng4a6spqgt30d3314dwll6y.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng49hfsqgoc0d33dj4ey9b7.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng47yrxqghn0d33nr4ttxk4.tfrecord", "gs://tfrecord-exports/cjng3yz76qf4v0d335kcjoj0r-2018-10-20T14:24:41-c934d9bf6b92a4a2a6486ab1/cjng45s6wqg4b0d3334s7ph0s.tfrecord"']
test_set_size = math.ceil(0.2 * len(tfrecord_paths))
training_dataset = (tf.data.TFRecordDataset(tfrecord_paths).skip(test_set_size).map(_parse_tfrecord).apply(tf.contrib.data.shuffle_and_repeat(50)).apply(tf.contrib.data.map_and_batch(_resize(512), 8)))
我收到以下错误消息:
AttributeError:'str'对象没有属性'read'
我没有找到合适的文档。请帮助我。