Fixing an Inference App Using Hugging Face Spaces and a YOLOv5 Model (Trained on NDL-DocL Dataset)

Overview In the following article, I introduced an inference app using Hugging Face Spaces and a YOLOv5 model trained on the NDL-DocL dataset. This app had stopped working, so I fixed it to make it operational again. https://huggingface.co/spaces/nakamura196/yolov5-ndl-layout Here are my notes on the changes made during this fix. Changes The modified app.py is shown below. i f i i m d i o ] t d a e ] d d m r m m o e n u i e r x e e p o p p d f p t t s t a m m o m o o e u p l c i m o o r r r l y r d r i # o r ] t u g g e r c p [ [ [ . t P t t o e f e m u e s t r r i l l ' ' ' = l I = l s s _ C t t s . . = p e e 『 『 『 a g L y j o u = w o p u = I J t s 源 源 平 g u r o s y ( l = i n u r o r = m S " i = 氏 氏 家 r n a i l o o i t r t v t n u e g a O Y o = 物 物 物 . c d m o n l m s e j h e _ t s r [ g N O n " 語 語 語 I h i p v o ) s s _ r i [ p . e ( L < [ 』 』 』 n ( o o 5 v : = u o b t m u I ( ) O = p ( ( ( t s r 5 l n o a t m t v 東 京 国 e h a t . m t . x t g _ a y 5 " s 京 都 文 r a s l o s l e h e i g p Y t 大 大 学 f r I o d . o s e m e e N O y 学 学 研 a e g m a e p a = a ( = D L l 総 所 究 c = r a d l a d = n g t " L O e 合 蔵 資 e F g ( ( n s u I e y p - v = 図 ) 料 ( a e " i d ( r m m , p i D 5 ' 書 . 館 y l n m a d e p a e l o t 館 j 提 o s a ) s f s y g = " c N e 所 p 供 l e k ( ) u e ' , L D x 蔵 g ) o ) a ) l a . p L t ) ' . , m # . t r f i l D - - . ] j u x s r r l a a D a j , p i r i y . a o ' b t o l p g n a n x r y m , e a c i g ' p 1 f y e a l s L g ' ] u 9 e [ n b r l = e n ] t 6 r 0 d a r a " t D : , s / e ] e c a b O s a , y n . r k y e u " t c o c t ( ( l t a e o l e o ) t i = p s n u o _ [ o m " u e t t v j 0 _ O t t e p 5 s ] a w r s r u - o n i i I ' t n n t g m G > s d ( # i h i a r Y , l o m _ n g a O - r r a b a e d L t l i e g o l " i O i a e s e x ) o v t y n u e I , 5 l o t l s m d e u = t ) a e N = t " s g m D t " r . e o L i ) e r " - t c e ) f D l o n o o e r d r c , d e L s r o d " ( b D e ) ) j a s e t c r c a r e t s i t e p u d t t r e s i n t o s e i n c s = a t d i a e l o n s i n c s . o r t b i U j p o p e t f l c i o t o i a n m d d , a e g a t a e n e r s c t i t i m i c a o l g n e e = m a o o r r d t e i c l c l l i t e c r , k a i e a n x n e a d m e p x o l a n e m s p t = l h e e e x a i < m m a p a l g h e e r s e ) t f = u " s h e t . t " p s : / / g i t h u b . c o m / n d l - l a b / l a y o u t - d a t a s e t \ " > N D L - D o c L D a t a s e t s < / a > . < / p > " First, due to Gradio version upgrades, I changed gr.inputs.Image to gr.Image and similar updates. ...

May 20, 2024 · 6 min · Nakamura

Dealing with AttributeError in ultralytics/yolov5

When using ultralytics/yolov5, the following error occurred. A t t r i b u t e E r r o r : ' D e t e c t i o n s ' o b j e c t h a s n o a t t r i b u t e ' i m g s ' As mentioned in the following issue, this appears to be caused by an API change. ...

October 18, 2022 · 2 min · Nakamura