File tree Expand file tree Collapse file tree 14 files changed +75
-140
lines changed Expand file tree Collapse file tree 14 files changed +75
-140
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ fn main() -> Result<()> {
4343
4444 // save
4545 for y in ys {
46- if let Some ( images) = y. images ( ) {
46+ let images = y. images ( ) ;
47+ if !images. is_empty ( ) {
4748 for image in images. iter ( ) {
4849 image. save ( format ! (
4950 "{}.png" ,
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ fn main() -> Result<()> {
7676
7777 // RTMPose infer
7878 for ( x, y_det) in xs. iter ( ) . zip ( ys_det. iter ( ) ) {
79- let y = rtmpose. forward ( x, y_det. hbbs ( ) ) ?;
79+ let y = rtmpose. forward ( x, Some ( y_det. hbbs ( ) ) ) ?;
8080
8181 // Annotate
8282 annotator. annotate ( x, & y) ?. save ( format ! (
Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ fn main() -> Result<()> {
5555 let ys = model. forward ( & xs, & args. prompt ) ?;
5656
5757 for y in ys. iter ( ) {
58- if let Some ( texts) = y. texts ( ) {
58+ let texts = y. texts ( ) ;
59+ if !texts. is_empty ( ) {
5960 for text in texts {
6061 println ! ( "\n [User]: {}\n [Assistant]:{:?}" , args. prompt, text) ;
6162 }
Original file line number Diff line number Diff line change @@ -62,15 +62,17 @@ fn main() -> Result<()> {
6262 Task :: Caption ( _) => {
6363 println ! ( "{}:" , task) ;
6464 for ( i, y) in ys. iter ( ) . enumerate ( ) {
65- if let Some ( texts) = y. texts ( ) {
65+ let texts = y. texts ( ) ;
66+ if !texts. is_empty ( ) {
6667 println ! ( "Image {}: {:?}\n " , i, texts[ 0 ] ) ;
6768 }
6869 }
6970 }
7071 Task :: Vqa ( query) => {
7172 println ! ( "Question: {}" , query) ;
7273 for ( i, y) in ys. iter ( ) . enumerate ( ) {
73- if let Some ( texts) = y. texts ( ) {
74+ let texts = y. texts ( ) ;
75+ if !texts. is_empty ( ) {
7476 println ! ( "Image {}: {:?}\n " , i, texts[ 0 ] ) ;
7577 }
7678 }
Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ fn main() -> Result<()> {
5555
5656 // results
5757 for ( x, y) in xs. iter ( ) . zip ( ys. iter ( ) ) {
58- if let Some ( texts) = y. texts ( ) {
58+ let texts = y. texts ( ) ;
59+ if !texts. is_empty ( ) {
5960 println ! ( "Image: {:?}" , x) ;
6061 println ! ( "Texts: {:?}" , texts) ;
6162 }
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ fn main() -> Result<()> {
101101
102102 // RTMPose infer
103103 for ( x, y_det) in xs. iter ( ) . zip ( ys_det. iter ( ) ) {
104- let y = rtmpose. forward ( x, y_det. hbbs ( ) ) ?;
104+ let y = rtmpose. forward ( x, Some ( y_det. hbbs ( ) ) ) ?;
105105
106106 // Annotate
107107 annotator. annotate ( x, & y) ?. save ( format ! (
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ fn main() -> Result<()> {
7575
7676 // RTMPose infer
7777 for ( x, y_det) in xs. iter ( ) . zip ( ys_det. iter ( ) ) {
78- let y = rtmpose. forward ( x, y_det. hbbs ( ) ) ?;
78+ let y = rtmpose. forward ( x, Some ( y_det. hbbs ( ) ) ) ?;
7979
8080 // Annotate
8181 annotator. annotate ( x, & y) ?. save ( format ! (
Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ fn main() -> Result<()> {
4545 let ys = model. forward ( & xs, & args. prompt ) ?;
4646
4747 for y in ys. iter ( ) {
48- if let Some ( texts) = y. texts ( ) {
48+ let texts = y. texts ( ) ;
49+ if !texts. is_empty ( ) {
4950 for text in texts {
5051 println ! ( "[User]: {}\n \n [Assistant]:{:?}" , args. prompt, text) ;
5152 }
Original file line number Diff line number Diff line change @@ -46,7 +46,8 @@ fn main() -> Result<()> {
4646
4747 // save
4848 for y in ys {
49- if let Some ( images) = y. images ( ) {
49+ let images = y. images ( ) ;
50+ if !images. is_empty ( ) {
5051 for image in images. iter ( ) {
5152 image. save ( format ! (
5253 "{}.png" ,
Original file line number Diff line number Diff line change @@ -44,7 +44,8 @@ fn main() -> Result<()> {
4444 // run & annotate
4545 let ys_det = yolo. forward ( & xs) ?;
4646 for y_det in ys_det. iter ( ) {
47- if let Some ( hbbs) = y_det. hbbs ( ) {
47+ let hbbs = y_det. hbbs ( ) ;
48+ if !hbbs. is_empty ( ) {
4849 // collect hhbs
4950 let mut prompt = SamPrompt :: default ( ) ;
5051 for hbb in hbbs {
You can’t perform that action at this time.
0 commit comments