File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
packages/paddlejs-core/src Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -68,8 +68,8 @@ export default class MediaProcessor {
6868 } ] as InputFeed [ ] ;
6969 }
7070
71- this . pixelWidth = pixels . width ;
72- this . pixelHeight = pixels . height ;
71+ this . pixelWidth = ( pixels as HTMLImageElement ) . naturalWidth || pixels . width ;
72+ this . pixelHeight = ( pixels as HTMLImageElement ) . naturalHeight || pixels . height ;
7373
7474
7575 this . fitToTargetSize ( pixels , imageDataInfo , env . get ( 'webgl_feed_process' ) ) ;
Original file line number Diff line number Diff line change @@ -209,12 +209,17 @@ export default class Runner {
209209 return tensorData . find ( tensor => tensor . tensorId . endsWith ( '_image' ) ) ;
210210 } ) as OpExecutor ;
211211
212- let imageInputTensor : Tensor = imageOp . opData . inputTensors [ 0 ] ;
213- const imageInputTensorParams = imageInputTensor . opts ;
214- imageInputTensorParams . shape = feed [ 0 ] . shape ;
215- imageInputTensorParams . data = feed [ 0 ] . data ;
216- imageInputTensor = new Tensor ( imageInputTensorParams ) ;
217- imageOp . opData . inputTensors = [ imageInputTensor ] ;
212+ const imageInputTensor = imageOp . opData . inputTensors . find (
213+ tensor => tensor . tensorId . endsWith ( '_image' )
214+ ) ;
215+ imageInputTensor . data = feed [ 0 ] . data ;
216+
217+ if ( env . get ( 'webgl_feed_process' ) ) {
218+ const imageInputTensorParams = imageInputTensor . opts ;
219+ imageInputTensorParams . shape = feed [ 0 ] . shape ;
220+ imageInputTensorParams . data = feed [ 0 ] . data ;
221+ imageOp . opData . inputTensors = [ new Tensor ( imageInputTensorParams ) ] ;
222+ }
218223 }
219224
220225 async execute ( ) {
You can’t perform that action at this time.
0 commit comments