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 {
68
68
} ] as InputFeed [ ] ;
69
69
}
70
70
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 ;
73
73
74
74
75
75
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 {
209
209
return tensorData . find ( tensor => tensor . tensorId . endsWith ( '_image' ) ) ;
210
210
} ) as OpExecutor ;
211
211
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
+ }
218
223
}
219
224
220
225
async execute ( ) {
You can’t perform that action at this time.
0 commit comments