Publishing a YOLOv11x Model on Hugging Face

This article introduces the steps to publish a YOLOv11x model trained on the Japanese Classical Kuzushiji Dataset on Hugging Face and create a demo with Gradio Spaces. Overview Model: YOLOv11x (for kuzushiji character detection) Dataset: Japanese Classical Kuzushiji Dataset Publication: Hugging Face Models + Spaces 1. Register the Model on Hugging Face Models 1.1 Install huggingface_hub p i p i n s t a l l h u g g i n g f a c e _ h u b 1.2 Login h u g g i n g f a c e - c l i l o g i n Or from Python: ...

January 26, 2026 · 5 min · Nakamura

Building a Character Detection Model Using YOLOv11x and the Japanese Classical Character Dataset

Overview I had the opportunity to build a character detection model using YOLOv11x and the Japanese Classical Character (Kuzushiji) Dataset, so this is a memo of the process. http://codh.rois.ac.jp/char-shape/ References Previously, I performed a similar task using YOLOv5. You can check the demo and pre-trained models at the following Spaces. https://huggingface.co/spaces/nakamura196/yolov5-char Below is an example of application to publicly available images from the “National Treasure Kanazawa Bunko Documents Database.” ...

November 6, 2024 · 6 min · Nakamura

Training YOLOv11 Classification (Kuzushiji Recognition) Using mdx.jp

Overview I had the opportunity to train YOLOv11 classification (kuzushiji recognition) using mdx.jp, so here are my notes. Dataset The following “Kuzushiji Dataset” is used as the target. http://codh.rois.ac.jp/char-shape/book/ Dataset Creation The dataset is formatted to match the YOLO format. First, data separated by book title is flattened and merged. # c | l a e s x s d p e o C f r l t a c # f # f s r i o s e " l o r i a . e u f t . s t f c o i # o s i e / p i l u f s h c _ d = u l s t p . u a d a t e p o r m t t a t g _ = u s c i a i i t a l d i t . o n k l o a / o i n f _ p n t e . n s * b r i f a t ( d c : e / ( t l i t i f i o t c i = q e l h n " r p ( h n d . e . u C s y s a p " m s e e o ( ( e r u . ( p = x p f f l a t . f l i y " i f c _ / i i f s i { l , t f d l t " t n o e e i a e ( { s g u , i r l t s " o ( t n s e a ) / u o { p o p / _ / : " t u f u u u * p d ) p t i t t t / a a [ u p l _ p _ * t t - t u e d u f . h a 2 _ t } i t i j ) s ] d _ r _ l p e i f t } f e g t r i o / i _ " " } l { l p / e { c e a { ) o l ) t c : u s h l t } , s p " } u , o / t u { _ e t f f x p i i i u l l s t e e t _ . } _ d s " o i p ) k r l = ) i T : t r ( u ' e / ) ' ) [ - 1 ] } " Next, the dataset is split using the following script. ...

November 6, 2024 · 37 min · Nakamura

Building an Inference App Using Hugging Face Spaces and YOLOv5 Model (Trained on KaoKore Dataset)

Overview I created an inference app using Hugging Face Spaces and a YOLOv5 model trained on the KaoKore dataset. The KaoKore dataset published by the Center for Open Data in the Humanities (CODH) is as follows: Yingtao Tian, Chikahiko Suzuki, Tarin Clanuwat, Mikel Bober-Irizar, Alex Lamb, Asanobu Kitamoto, “KaoKore: A Pre-modern Japanese Art Facial Expression Dataset”, arXiv:2002.08595. http://codh.rois.ac.jp/face/dataset/ You can try the inference app at the following URL: https://huggingface.co/spaces/nakamura196/yolov5-face The source code and trained model can be downloaded from the following URL. I hope it serves as a reference when developing similar applications. ...

October 5, 2024 · 1 min · Nakamura

Resolving ModuleNotFoundError: No module named 'huggingface_hub.utils._errors'

Overview When deploying an app to Hugging Face Spaces, the following error occurred. This is a memo about that error. C V U W T M D r i p A r o u e e d R a F F F d r a w a N c i i i u i t t I e l m l r l f l n i U e N b e o e e e r e g n l G a d s o N g t S c " e " u " m o h r e ⚠ k / l / l / t a n a t ️ u u t u h F n e l t ( s = s s u o d w y i D m r r = r g u l t n e o / D / / g n i U i g t s l e l a l i d n l c s e t o t o t o n E g t s c c e c t c g r r w t r a c a e a f r o a S i M e l t l m l a o f l e t u c / M / p / c r y t h l e l u l t l e : t t t t n i l i _ i _ h i i ' i t b t b d b h N e c n y B / i / o / u o s g o a c p B p w p b a s l c a y a y n y . m b S o k l t c t l t u o o e w e l h k h o h t d v t i s n o e o a o i u e t t e d l n n n d n l l i h t a 3 d 3 _ 3 s e e n t f s . ( . f . . x g ' i a t 1 1 r 1 _ n c s y n i ) 0 0 0 e a e o g l : / m / r m p v l s e s s _ s r e t 0 o d i i h i o d i . k : t t u t r o 0 s e e e b e s ' n . e y N - - ( - h , 6 t = o p p w p i u t v a a , a m g a f i a m c c c p g n i n l o k k h k o i o l g u d a a f a r n t e s e u g g _ g t g h ' ' l e e t e f e ✅ , e s s s R a r o / k / e c r i n y y e y p e e . a o o n o o _ x a e m l l = l s h c t . e o o h o i u e d v v f v t b p ' 5 5 _ 5 . t y ' / / t r u i h o h h m u y t o o l u e o k t N i n m o g l d e i o l e g p e n l t s o / s i e l ) s F . c u e n r s / o _ c s t g s / d u e u e t f . c o n r r r i a p o w d r r / n c y m n E o e . g e " m l r r d c s _ , o o r s : o h n a o ' n r u l . d r f u b i p s i n . n y . g s u e " p / _ t , y U d i 3 " l i l 8 l , t r s , i r = . n l a p _ i e i l a e n n y t r 3 e t h r l 3 i / o o 8 1 c t r a , 5 s s d 0 / ' _ i , s d m n e i o i t r d n t ' e _ i . l i a n n t g F i t s o t e . r _ m j _ p s h t o e _ n l d ' p o w s n e l e o a h d t _ t f p r s o : m / _ / h d u o b c s . u l t r a l y t i c s . c o m / q u i c k s t a r t / # u l t r a l y t i c s - s e t t i n g s . Reference The following article was helpful. ...

October 4, 2024 · 5 min · Nakamura

Inference App Using a YOLOv5 Model (Character Region Detection)

Overview The character region detection app is published at the following link. https://huggingface.co/spaces/nakamura196/yolov5-char The above app had stopped working, so I fixed it following the same procedure as in the following article. The model used in this app was built using the “Japanese Classical Character Dataset” (held by NIJL and others / processed by CODH) doi:10.20676/00000340. I also made some minor improvements during this fix, which I will introduce here. ...

May 23, 2024 · 4 min · Nakamura

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

Handling ultralyticsplus: ValueError: Invalid CUDA 'device=0' requested...

Overview I have published an inference app using YOLOv8 at the following link: https://huggingface.co/spaces/nakamura196/yolov8-ndl-layout Initially, the following error occurred: V t t o S a o o s e l r r . e u c c e e h h n h E . . v t r c c i t r u u r p o d d o s r a a n : : . . [ i d ' / I s e C p n _ v U y v a i D t a v c A o l a e _ r i i _ V c d l c I h a o S . C b u I o U l n B r D e t L g A ( ( E / ) ) _ g ' : : D e d E t e F 0 V - v a I s i l C t c s E a e e S r = ' t 0 ] e ' : d / r N l e o o q n c u e a e l s l t y e / d . f o U r s e u p ' - d t e o v - i d c a e t = e c p t u o ' r c o h r i p n a s s t s a l v l a l i i n d s t C r U u D c A t i d o e n v s i c i e f ( s n ) o i C f U D a A v a d i e l v a i b c l e e s , a i r . e e . s e ' e d n e v b i y c e t = o 0 r ' c h o . r ' d e v i c e = 0 , 1 , 2 , 3 ' f o r M u l t i - G P U . This error was resolved by adding device as follows: ...

May 20, 2024 · 4 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

Returning JSON from Hugging Face Spaces

Previously, I built an inference app using Hugging Face Spaces and a YOLOv5 model (trained on the NDL-DocL dataset): This time, I modified the app above to add JSON output, as shown in the following diff: https://huggingface.co/spaces/nakamura196/yolov5-ndl-layout/commit/4d48b95ce080edd28d68fba2b5b33cc17b9b9ecb#d2h-120906 This enables processing using the returned results, as shown in the following notebook: https://github.com/nakamura196/ndl_ocr/blob/main/GradioのAPIを用いた物体検出例.ipynb There may be better approaches, but I hope this serves as a useful reference.

August 16, 2022 · 1 min · Nakamura

Building a Layout Extraction Model Using the NDL-DocL Dataset and YOLOv5

Overview I built a layout extraction model using the NDL-DocL dataset and YOLOv5. https://github.com/ndl-lab/layout-dataset https://github.com/ultralytics/yolov5 You can try this model using the following notebook. https://colab.research.google.com/github/nakamura196/ndl_ocr/blob/main/NDL_DocLデータセットとYOLOv5を用いたレイアウト抽出モデル.ipynb This article is a record of the training process above. Creating the Dataset The NDL-DocL dataset in Pascal VOC format is converted to YOLO format. For this method, refer to the following article. In addition to the conversion from Pascal VOC format to COCO format, conversion from COCO format to YOLO format was added. ...

July 25, 2022 · 1 min · Nakamura

Building an Object Detection API Using AWS Lambda (Flask + YOLOv5)

Overview We build an object detection API (Flask + YOLOv5) using AWS Lambda. By building a machine learning inference model using AWS Lambda, we aim to reduce costs. The following article was used as a reference. https://zenn.dev/gokauz/articles/72e543796a6423 Updates to the repository contents and additions of how to use it from API Gateway have been made. Registering Functions on Lambda Clone the following GitHub repository. g i t c l o n e h t t p s : / / g i t h u b . c o m / l d a s j p 8 / y o l o v 5 - l a m b d a . g i t Running Locally Next, create a virtual environment using venv and install the modules. ...

March 24, 2022 · 5 min · Nakamura

How to Use a Flask-Based YOLOv5 Model Repository with ECR and AWS App Runner

This article introduces an example of building an object detection API using AWS App Runner and YOLOv5. Amazon ECR I registered the following repository, which publishes a YOLOv5 model using Flask, to the Amazon ECR (Elastic Container Registry) public registry. https://github.com/robmarkcole/yolov5-flask https://gallery.ecr.aws/b8m8i5m3/yolov5-flask I made some modifications to the source code from the original repository. The forked repository is here: https://github.com/ldasjp8/yolov5-flask Below, I will explain how to use this image with App Runner as an example. ...

March 21, 2022 · 1 min · Nakamura