亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

嘗試從圖像中提取補丁并得到“UnimplementedError:只支持跨空間的 ksizes”

嘗試從圖像中提取補丁并得到“UnimplementedError:只支持跨空間的 ksizes”

當年話下 2023-04-18 15:28:05
當我遇到以下錯誤時,我試圖通過 4 個補丁拆分我的圖像:UnimplementedError: Only support ksizes across spaceiterator = tf.compat.v1.data.make_one_shot_iterator(parsed_dataset) image,label = iterator.get_next()image_height = image.shape[0]image_width = image.shape[1]# Since the expected type is (batch,height,width,channels), i have tryied to expand my image that have# dimensions: (800,344,3) to (1,800,344,3) but didn't solved the error.#image = tf.expand_dims(image ,0)images = list(image)extracted_patches = tf.image.extract_patches(images=images,                                             sizes=[1,int(0.25*image_height),int(0.25*image_width),3],                                             strides=[1,int(0.25*image_height),int(0.25*image_width),3],                                             rates=[1,1,1,1],                                             padding="SAME")追溯:---------------------------------------------------------------------------UnimplementedError                        Traceback (most recent call last)<ipython-input-64-23c2aff4c306> in <module>()     17                                              strides=[1,int(0.25*image_height),int(0.25*image_width),3],     18                                              rates=[1,1,1,1],---> 19                                              padding="SAME")     20      21 /Users/lucianoaraujo/anaconda2/lib/python2.7/site-packages/tensorflow_core/python/ops/array_ops.pyc in extract_image_patches_v2(images, sizes, strides, rates, padding, name)   4657   """   4658   return gen_array_ops.extract_image_patches(images, sizes, strides, rates,-> 4659                                              padding, name)   4660    4661 
查看完整描述

1 回答

?
慕碼人2483693

TA貢獻1860條經驗 獲得超9個贊

經過進一步的研究,我能夠通過改變來管理:


images = list(image)

extracted_patches = tf.image.extract_patches(images=images,

                                             sizes=[1,int(0.25*image_height),int(0.25*image_width),3],

                                             strides=[1,int(0.25*image_height),int(0.25*image_width),3],

                                             rates=[1,1,1,1],

                                             padding="SAME")

到 :


image = tf.expand_dims(image ,0)

extracted_patches = tf.image.extract_patches(images=image,

                                             sizes=[1,int(0.25*image_height),int(0.25*image_width),1],

                                             strides=[1,int(0.25*image_height),int(0.25*image_width),1],

                                             rates=[1,1,1,1],

                                             padding="SAME")

然后重塑以獲得3通道圖像:


patches = tf.reshape(extracted_patches,[-1,int(0.25*image_height),int(0.25*image_width),3])



查看完整回答
反對 回復 2023-04-18
  • 1 回答
  • 0 關注
  • 144 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號