narugo1992 commited on
Commit
2023a9f
1 Parent(s): 4c1a7d5

dev(narugo): init commit

Browse files
Files changed (7) hide show
  1. .gitignore +1216 -0
  2. README.md +1 -1
  3. app.py +27 -0
  4. cls.py +37 -0
  5. onnx_.py +59 -0
  6. preprocess.py +19 -0
  7. requirements.txt +11 -0
.gitignore ADDED
@@ -0,0 +1,1216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Created by .ignore support plugin (hsz.mobi)
2
+ ### Example user template template
3
+ ### Example user template
4
+
5
+ # IntelliJ project files
6
+ .idea
7
+ *.iml
8
+ out
9
+ gen
10
+ ### CVS template
11
+ /CVS/*
12
+ **/CVS/*
13
+ .cvsignore
14
+ */.cvsignore
15
+
16
+ ### C++ template
17
+ # Prerequisites
18
+ *.d
19
+
20
+ # Compiled Object files
21
+ *.slo
22
+ *.lo
23
+ *.o
24
+ *.obj
25
+
26
+ # Precompiled Headers
27
+ *.gch
28
+ *.pch
29
+
30
+ # Compiled Dynamic libraries
31
+ *.so
32
+ *.dylib
33
+ *.dll
34
+
35
+ # Fortran module files
36
+ *.mod
37
+ *.smod
38
+
39
+ # Compiled Static libraries
40
+ *.lai
41
+ *.la
42
+ *.a
43
+ *.lib
44
+
45
+ # Executables
46
+ *.exe
47
+ *.out
48
+ *.app
49
+
50
+ ### CUDA template
51
+ *.i
52
+ *.ii
53
+ *.gpu
54
+ *.ptx
55
+ *.cubin
56
+ *.fatbin
57
+
58
+ ### SVN template
59
+ .svn/
60
+
61
+ ### Images template
62
+ # JPEG
63
+ *.jpe
64
+ *.jif
65
+ *.jfif
66
+ *.jfi
67
+
68
+ # JPEG 2000
69
+ *.jp2
70
+ *.j2k
71
+ *.jpf
72
+ *.jpx
73
+ *.jpm
74
+ *.mj2
75
+
76
+ # JPEG XR
77
+ *.jxr
78
+ *.hdp
79
+ *.wdp
80
+
81
+ # Graphics Interchange Format
82
+ *.gif
83
+
84
+ # RAW
85
+ *.raw
86
+
87
+ # Web P
88
+ *.webp
89
+
90
+ # Animated Portable Network Graphics
91
+ *.apng
92
+
93
+ # Multiple-image Network Graphics
94
+ *.mng
95
+
96
+ # Tagged Image File Format
97
+ *.tiff
98
+ *.tif
99
+
100
+ # Scalable Vector Graphics
101
+ *.svg
102
+ *.svgz
103
+
104
+ # Portable Document Format
105
+ *.pdf
106
+
107
+ # X BitMap
108
+ *.xbm
109
+
110
+ # BMP
111
+ *.bmp
112
+ *.dib
113
+
114
+ # ICO
115
+ *.ico
116
+
117
+ # 3D Images
118
+ *.3dm
119
+ *.max
120
+
121
+ ### Eclipse template
122
+ .metadata
123
+ bin/
124
+ tmp/
125
+ *.tmp
126
+ *.bak
127
+ *.swp
128
+ *~.nib
129
+ local.properties
130
+ .settings/
131
+ .loadpath
132
+ .recommenders
133
+
134
+ # External tool builders
135
+ .externalToolBuilders/
136
+
137
+ # Locally stored "Eclipse launch configurations"
138
+ *.launch
139
+
140
+ # PyDev specific (Python IDE for Eclipse)
141
+ *.pydevproject
142
+
143
+ # CDT-specific (C/C++ Development Tooling)
144
+ .cproject
145
+
146
+ # CDT- autotools
147
+ .autotools
148
+
149
+ # Java annotation processor (APT)
150
+ .factorypath
151
+
152
+ # PDT-specific (PHP Development Tools)
153
+ .buildpath
154
+
155
+ # sbteclipse plugin
156
+ .target
157
+
158
+ # Tern plugin
159
+ .tern-project
160
+
161
+ # TeXlipse plugin
162
+ .texlipse
163
+
164
+ # STS (Spring Tool Suite)
165
+ .springBeans
166
+
167
+ # Code Recommenders
168
+ .recommenders/
169
+
170
+ # Annotation Processing
171
+ .apt_generated/
172
+ .apt_generated_test/
173
+
174
+ # Scala IDE specific (Scala & Java development for Eclipse)
175
+ .cache-main
176
+ .scala_dependencies
177
+ .worksheet
178
+
179
+ # Uncomment this line if you wish to ignore the project description file.
180
+ # Typically, this file would be tracked if it contains build/dependency configurations:
181
+ #.project
182
+
183
+ ### Diff template
184
+ *.patch
185
+ *.diff
186
+
187
+ ### macOS template
188
+ # General
189
+ .DS_Store
190
+ .AppleDouble
191
+ .LSOverride
192
+
193
+ # Icon must end with two \r
194
+ Icon
195
+
196
+ # Thumbnails
197
+ ._*
198
+
199
+ # Files that might appear in the root of a volume
200
+ .DocumentRevisions-V100
201
+ .fseventsd
202
+ .Spotlight-V100
203
+ .TemporaryItems
204
+ .Trashes
205
+ .VolumeIcon.icns
206
+ .com.apple.timemachine.donotpresent
207
+
208
+ # Directories potentially created on remote AFP share
209
+ .AppleDB
210
+ .AppleDesktop
211
+ Network Trash Folder
212
+ Temporary Items
213
+ .apdisk
214
+
215
+ ### CMake template
216
+ CMakeLists.txt.user
217
+ CMakeCache.txt
218
+ CMakeFiles
219
+ CMakeScripts
220
+ Testing
221
+ cmake_install.cmake
222
+ install_manifest.txt
223
+ compile_commands.json
224
+ CTestTestfile.cmake
225
+ _deps
226
+
227
+ ### Linux template
228
+ *~
229
+
230
+ # temporary files which can be created if a process still has a handle open of a deleted file
231
+ .fuse_hidden*
232
+
233
+ # KDE directory preferences
234
+ .directory
235
+
236
+ # Linux trash folder which might appear on any partition or disk
237
+ .Trash-*
238
+
239
+ # .nfs files are created when an open file is removed but is still being accessed
240
+ .nfs*
241
+
242
+ ### MicrosoftOffice template
243
+ *.tmp
244
+
245
+ # Word temporary
246
+ ~$*.doc*
247
+
248
+ # Word Auto Backup File
249
+ Backup of *.doc*
250
+
251
+ # Excel temporary
252
+ ~$*.xls*
253
+
254
+ # Excel Backup File
255
+ *.xlk
256
+
257
+ # PowerPoint temporary
258
+ ~$*.ppt*
259
+
260
+ # Visio autosave temporary files
261
+ *.~vsd*
262
+
263
+ ### VisualStudio template
264
+ ## Ignore Visual Studio temporary files, build results, and
265
+ ## files generated by popular Visual Studio add-ons.
266
+ ##
267
+ ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
268
+
269
+ # User-specific files
270
+ *.rsuser
271
+ *.suo
272
+ *.user
273
+ *.userosscache
274
+ *.sln.docstates
275
+
276
+ # User-specific files (MonoDevelop/Xamarin Studio)
277
+ *.userprefs
278
+
279
+ # Mono auto generated files
280
+ mono_crash.*
281
+
282
+ # Build results
283
+ [Dd]ebug/
284
+ [Dd]ebugPublic/
285
+ [Rr]elease/
286
+ [Rr]eleases/
287
+ x64/
288
+ x86/
289
+ [Ww][Ii][Nn]32/
290
+ [Aa][Rr][Mm]/
291
+ [Aa][Rr][Mm]64/
292
+ bld/
293
+ [Bb]in/
294
+ [Oo]bj/
295
+ [Ll]og/
296
+ [Ll]ogs/
297
+
298
+ # Visual Studio 2015/2017 cache/options directory
299
+ .vs/
300
+ # Uncomment if you have tasks that create the project's static files in wwwroot
301
+ #wwwroot/
302
+
303
+ # Visual Studio 2017 auto generated files
304
+ Generated\ Files/
305
+
306
+ # MSTest test Results
307
+ [Tt]est[Rr]esult*/
308
+ [Bb]uild[Ll]og.*
309
+
310
+ # NUnit
311
+ *.VisualState.xml
312
+ TestResult.xml
313
+ nunit-*.xml
314
+
315
+ # Build Results of an ATL Project
316
+ [Dd]ebugPS/
317
+ [Rr]eleasePS/
318
+ dlldata.c
319
+
320
+ # Benchmark Results
321
+ BenchmarkDotNet.Artifacts/
322
+
323
+ # .NET Core
324
+ project.lock.json
325
+ project.fragment.lock.json
326
+ artifacts/
327
+
328
+ # ASP.NET Scaffolding
329
+ ScaffoldingReadMe.txt
330
+
331
+ # StyleCop
332
+ StyleCopReport.xml
333
+
334
+ # Files built by Visual Studio
335
+ *_i.c
336
+ *_p.c
337
+ *_h.h
338
+ *.ilk
339
+ *.meta
340
+ *.obj
341
+ *.iobj
342
+ *.pch
343
+ *.pdb
344
+ *.ipdb
345
+ *.pgc
346
+ *.pgd
347
+ *.rsp
348
+ *.sbr
349
+ *.tlb
350
+ *.tli
351
+ *.tlh
352
+ *.tmp
353
+ *.tmp_proj
354
+ *_wpftmp.csproj
355
+ *.log
356
+ *.vspscc
357
+ *.vssscc
358
+ .builds
359
+ *.pidb
360
+ *.svclog
361
+ *.scc
362
+
363
+ # Chutzpah Test files
364
+ _Chutzpah*
365
+
366
+ # Visual C++ cache files
367
+ ipch/
368
+ *.aps
369
+ *.ncb
370
+ *.opendb
371
+ *.opensdf
372
+ *.sdf
373
+ *.cachefile
374
+ *.VC.db
375
+ *.VC.VC.opendb
376
+
377
+ # Visual Studio profiler
378
+ *.psess
379
+ *.vsp
380
+ *.vspx
381
+ *.sap
382
+
383
+ # Visual Studio Trace Files
384
+ *.e2e
385
+
386
+ # TFS 2012 Local Workspace
387
+ $tf/
388
+
389
+ # Guidance Automation Toolkit
390
+ *.gpState
391
+
392
+ # ReSharper is a .NET coding add-in
393
+ _ReSharper*/
394
+ *.[Rr]e[Ss]harper
395
+ *.DotSettings.user
396
+
397
+ # TeamCity is a build add-in
398
+ _TeamCity*
399
+
400
+ # DotCover is a Code Coverage Tool
401
+ *.dotCover
402
+
403
+ # AxoCover is a Code Coverage Tool
404
+ .axoCover/*
405
+ !.axoCover/settings.json
406
+
407
+ # Coverlet is a free, cross platform Code Coverage Tool
408
+ coverage*.json
409
+ coverage*.xml
410
+ coverage*.info
411
+
412
+ # Visual Studio code coverage results
413
+ *.coverage
414
+ *.coveragexml
415
+
416
+ # NCrunch
417
+ _NCrunch_*
418
+ .*crunch*.local.xml
419
+ nCrunchTemp_*
420
+
421
+ # MightyMoose
422
+ *.mm.*
423
+ AutoTest.Net/
424
+
425
+ # Web workbench (sass)
426
+ .sass-cache/
427
+
428
+ # Installshield output folder
429
+ [Ee]xpress/
430
+
431
+ # DocProject is a documentation generator add-in
432
+ DocProject/buildhelp/
433
+ DocProject/Help/*.HxT
434
+ DocProject/Help/*.HxC
435
+ DocProject/Help/*.hhc
436
+ DocProject/Help/*.hhk
437
+ DocProject/Help/*.hhp
438
+ DocProject/Help/Html2
439
+ DocProject/Help/html
440
+
441
+ # Click-Once directory
442
+ publish/
443
+
444
+ # Publish Web Output
445
+ *.[Pp]ublish.xml
446
+ *.azurePubxml
447
+ # Note: Comment the next line if you want to checkin your web deploy settings,
448
+ # but database connection strings (with potential passwords) will be unencrypted
449
+ *.pubxml
450
+ *.publishproj
451
+
452
+ # Microsoft Azure Web App publish settings. Comment the next line if you want to
453
+ # checkin your Azure Web App publish settings, but sensitive information contained
454
+ # in these scripts will be unencrypted
455
+ PublishScripts/
456
+
457
+ # NuGet Packages
458
+ *.nupkg
459
+ # NuGet Symbol Packages
460
+ *.snupkg
461
+ # The packages folder can be ignored because of Package Restore
462
+ **/[Pp]ackages/*
463
+ # except build/, which is used as an MSBuild target.
464
+ !**/[Pp]ackages/build/
465
+ # Uncomment if necessary however generally it will be regenerated when needed
466
+ #!**/[Pp]ackages/repositories.config
467
+ # NuGet v3's project.json files produces more ignorable files
468
+ *.nuget.props
469
+ *.nuget.targets
470
+
471
+ # Microsoft Azure Build Output
472
+ csx/
473
+ *.build.csdef
474
+
475
+ # Microsoft Azure Emulator
476
+ ecf/
477
+ rcf/
478
+
479
+ # Windows Store app package directories and files
480
+ AppPackages/
481
+ BundleArtifacts/
482
+ Package.StoreAssociation.xml
483
+ _pkginfo.txt
484
+ *.appx
485
+ *.appxbundle
486
+ *.appxupload
487
+
488
+ # Visual Studio cache files
489
+ # files ending in .cache can be ignored
490
+ *.[Cc]ache
491
+ # but keep track of directories ending in .cache
492
+ !?*.[Cc]ache/
493
+
494
+ # Others
495
+ ClientBin/
496
+ ~$*
497
+ *~
498
+ *.dbmdl
499
+ *.dbproj.schemaview
500
+ *.jfm
501
+ *.pfx
502
+ *.publishsettings
503
+ orleans.codegen.cs
504
+
505
+ # Including strong name files can present a security risk
506
+ # (https://github.com/github/gitignore/pull/2483#issue-259490424)
507
+ #*.snk
508
+
509
+ # Since there are multiple workflows, uncomment next line to ignore bower_components
510
+ # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
511
+ #bower_components/
512
+
513
+ # RIA/Silverlight projects
514
+ Generated_Code/
515
+
516
+ # Backup & report files from converting an old project file
517
+ # to a newer Visual Studio version. Backup files are not needed,
518
+ # because we have git ;-)
519
+ _UpgradeReport_Files/
520
+ Backup*/
521
+ UpgradeLog*.XML
522
+ UpgradeLog*.htm
523
+ ServiceFabricBackup/
524
+ *.rptproj.bak
525
+
526
+ # SQL Server files
527
+ *.mdf
528
+ *.ldf
529
+ *.ndf
530
+
531
+ # Business Intelligence projects
532
+ *.rdl.data
533
+ *.bim.layout
534
+ *.bim_*.settings
535
+ *.rptproj.rsuser
536
+ *- [Bb]ackup.rdl
537
+ *- [Bb]ackup ([0-9]).rdl
538
+ *- [Bb]ackup ([0-9][0-9]).rdl
539
+
540
+ # Microsoft Fakes
541
+ FakesAssemblies/
542
+
543
+ # GhostDoc plugin setting file
544
+ *.GhostDoc.xml
545
+
546
+ # Node.js Tools for Visual Studio
547
+ .ntvs_analysis.dat
548
+ node_modules/
549
+
550
+ # Visual Studio 6 build log
551
+ *.plg
552
+
553
+ # Visual Studio 6 workspace options file
554
+ *.opt
555
+
556
+ # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
557
+ *.vbw
558
+
559
+ # Visual Studio LightSwitch build output
560
+ **/*.HTMLClient/GeneratedArtifacts
561
+ **/*.DesktopClient/GeneratedArtifacts
562
+ **/*.DesktopClient/ModelManifest.xml
563
+ **/*.Server/GeneratedArtifacts
564
+ **/*.Server/ModelManifest.xml
565
+ _Pvt_Extensions
566
+
567
+ # Paket dependency manager
568
+ .paket/paket.exe
569
+ paket-files/
570
+
571
+ # FAKE - F# Make
572
+ .fake/
573
+
574
+ # CodeRush personal settings
575
+ .cr/personal
576
+
577
+ # Python Tools for Visual Studio (PTVS)
578
+ __pycache__/
579
+ *.pyc
580
+
581
+ # Cake - Uncomment if you are using it
582
+ # tools/**
583
+ # !tools/packages.config
584
+
585
+ # Tabs Studio
586
+ *.tss
587
+
588
+ # Telerik's JustMock configuration file
589
+ *.jmconfig
590
+
591
+ # BizTalk build output
592
+ *.btp.cs
593
+ *.btm.cs
594
+ *.odx.cs
595
+ *.xsd.cs
596
+
597
+ # OpenCover UI analysis results
598
+ OpenCover/
599
+
600
+ # Azure Stream Analytics local run output
601
+ ASALocalRun/
602
+
603
+ # MSBuild Binary and Structured Log
604
+ *.binlog
605
+
606
+ # NVidia Nsight GPU debugger configuration file
607
+ *.nvuser
608
+
609
+ # MFractors (Xamarin productivity tool) working folder
610
+ .mfractor/
611
+
612
+ # Local History for Visual Studio
613
+ .localhistory/
614
+
615
+ # BeatPulse healthcheck temp database
616
+ healthchecksdb
617
+
618
+ # Backup folder for Package Reference Convert tool in Visual Studio 2017
619
+ MigrationBackup/
620
+
621
+ # Ionide (cross platform F# VS Code tools) working folder
622
+ .ionide/
623
+
624
+ # Fody - auto-generated XML schema
625
+ FodyWeavers.xsd
626
+
627
+ ### Vim template
628
+ # Swap
629
+ [._]*.s[a-v][a-z]
630
+ !*.svg # comment out if you don't need vector files
631
+ [._]*.sw[a-p]
632
+ [._]s[a-rt-v][a-z]
633
+ [._]ss[a-gi-z]
634
+ [._]sw[a-p]
635
+
636
+ # Session
637
+ Session.vim
638
+ Sessionx.vim
639
+
640
+ # Temporary
641
+ .netrwhist
642
+ *~
643
+ # Auto-generated tag files
644
+ tags
645
+ # Persistent undo
646
+ [._]*.un~
647
+
648
+ ### Backup template
649
+ *.bak
650
+ *.gho
651
+ *.ori
652
+ *.orig
653
+ *.tmp
654
+
655
+ ### SublimeText template
656
+ # Cache files for Sublime Text
657
+ *.tmlanguage.cache
658
+ *.tmPreferences.cache
659
+ *.stTheme.cache
660
+
661
+ # Workspace files are user-specific
662
+ *.sublime-workspace
663
+
664
+ # Project files should be checked into the repository, unless a significant
665
+ # proportion of contributors will probably not be using Sublime Text
666
+ # *.sublime-project
667
+
668
+ # SFTP configuration file
669
+ sftp-config.json
670
+ sftp-config-alt*.json
671
+
672
+ # Package control specific files
673
+ Package Control.last-run
674
+ Package Control.ca-list
675
+ Package Control.ca-bundle
676
+ Package Control.system-ca-bundle
677
+ Package Control.cache/
678
+ Package Control.ca-certs/
679
+ Package Control.merged-ca-bundle
680
+ Package Control.user-ca-bundle
681
+ oscrypto-ca-bundle.crt
682
+ bh_unicode_properties.cache
683
+
684
+ # Sublime-github package stores a github token in this file
685
+ # https://packagecontrol.io/packages/sublime-github
686
+ GitHub.sublime-settings
687
+
688
+ ### C template
689
+ # Prerequisites
690
+ *.d
691
+
692
+ # Object files
693
+ *.o
694
+ *.ko
695
+ *.obj
696
+ *.elf
697
+
698
+ # Linker output
699
+ *.ilk
700
+ *.map
701
+ *.exp
702
+
703
+ # Precompiled Headers
704
+ *.gch
705
+ *.pch
706
+
707
+ # Libraries
708
+ *.lib
709
+ *.a
710
+ *.la
711
+ *.lo
712
+
713
+ # Shared objects (inc. Windows DLLs)
714
+ *.dll
715
+ *.so
716
+ *.so.*
717
+ *.dylib
718
+
719
+ # Executables
720
+ *.exe
721
+ *.out
722
+ *.app
723
+ *.i*86
724
+ *.x86_64
725
+ *.hex
726
+
727
+ # Debug files
728
+ *.dSYM/
729
+ *.su
730
+ *.idb
731
+ *.pdb
732
+
733
+ # Kernel Module Compile Results
734
+ *.mod*
735
+ *.cmd
736
+ .tmp_versions/
737
+ modules.order
738
+ Module.symvers
739
+ Mkfile.old
740
+ dkms.conf
741
+
742
+ ### VirtualEnv template
743
+ # Virtualenv
744
+ # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
745
+ .Python
746
+ [Bb]in
747
+ [Ii]nclude
748
+ [Ll]ib
749
+ [Ll]ib64
750
+ [Ll]ocal
751
+ [Ss]cripts
752
+ pyvenv.cfg
753
+ .venv
754
+ pip-selfcheck.json
755
+
756
+ ### LibreOffice template
757
+ # LibreOffice locks
758
+ .~lock.*#
759
+
760
+ ### Xilinx template
761
+ # gitignore template for Xilinx Vivado Design Suite
762
+ # website: https://www.xilinx.com/support/download.html
763
+
764
+ # [home]
765
+ *.jou
766
+ *.log
767
+ *.debug
768
+ *.str
769
+ *.tmp
770
+ *.os
771
+ *.js
772
+ *.pb
773
+ *.dcp
774
+ *.hwdef
775
+ *.vds
776
+ *.veo
777
+ *.wdf
778
+ *.vdi
779
+ *.dmp
780
+ *.rpx
781
+ *.rpt
782
+ *_stub.v
783
+ *_stub.vhdl
784
+ *_funcsim.v
785
+ *_funcsim.vhdl
786
+ .project
787
+
788
+ # [dir]
789
+ *.cache
790
+ .metadata
791
+ *.data
792
+ *.ipdefs
793
+ .Xil
794
+ *.sdk
795
+ *.hw
796
+ *.ip_user_files
797
+
798
+ ### IP synth
799
+ *_synth_*
800
+
801
+ .jobs
802
+
803
+ ### project synth
804
+ */*.runs/synth*/*.xml
805
+ */*.runs/synth*/*.txt
806
+ */*.runs/synth*/*.sh
807
+ */*.runs/synth*/*.tcl
808
+ */*.runs/synth*/*.bat
809
+ */*.runs/synth*/*.xdc
810
+ !*/*.runs/synth*/*utilization*.rpt
811
+
812
+ *.runs/synth*/*.xml
813
+ *.runs/synth*/*.txt
814
+ *.runs/synth*/*.sh
815
+ *.runs/synth*/*.tcl
816
+ *.runs/synth*/*.bat
817
+ *.runs/synth*/*.xdc
818
+ !*.runs/synth*/*utilization*.rpt
819
+
820
+ ### project impl
821
+ */*.runs/impl*/*.xml
822
+ */*.runs/impl*/*.html
823
+ */*.runs/impl*/*.txt
824
+ */*.runs/impl*/*.sh
825
+ */*.runs/impl*/*.tcl
826
+ */*.runs/impl*/*.bat
827
+ !*/*.runs/impl*/*utilization*.rpt
828
+
829
+ *.runs/impl*/*.xml
830
+ *.runs/impl*/*.html
831
+ *.runs/impl*/*.txt
832
+ *.runs/impl*/*.sh
833
+ *.runs/impl*/*.tcl
834
+ *.runs/impl*/*.bat
835
+ !*.runs/impl*/*utilization*.rpt
836
+
837
+ ### block design
838
+ */*/bd/*/hdl
839
+ */*/*/bd/*/hdl
840
+
841
+ */*/bd/*/*.xdc
842
+ */*/*/bd/*/*.xdc
843
+
844
+ */*/bd/*/ip/*/*.xdc
845
+ */*/*/bd/*/ip/*/*.xdc
846
+
847
+ */*/bd/*/ip/*/*/
848
+ */*/*/bd/*/ip/*/*/
849
+
850
+ */*/bd/*/ip/*/*.vhd
851
+ */*/*/bd/*/ip/*/*.vhd
852
+
853
+ */*/bd/*/ip/*/*.xml
854
+ */*/*/bd/*/ip/*/*.xml
855
+
856
+ *.c
857
+ *.cpp
858
+ *.h
859
+ *.vho
860
+ */*/bd/*/ip/*/*.tcl
861
+ */*/*/bd/*/ip/*/*.tcl
862
+ hw_handoff
863
+ ipshared
864
+
865
+ ### Lua template
866
+ # Compiled Lua sources
867
+ luac.out
868
+
869
+ # luarocks build files
870
+ *.src.rock
871
+ *.zip
872
+
873
+ # Object files
874
+ *.o
875
+ *.os
876
+ *.ko
877
+ *.obj
878
+ *.elf
879
+
880
+ # Precompiled Headers
881
+ *.gch
882
+ *.pch
883
+
884
+ # Libraries
885
+ *.lib
886
+ *.a
887
+ *.la
888
+ *.lo
889
+ *.def
890
+ *.exp
891
+
892
+ # Shared objects (inc. Windows DLLs)
893
+ *.dll
894
+ *.so
895
+ *.so.*
896
+ *.dylib
897
+
898
+ # Executables
899
+ *.exe
900
+ *.out
901
+ *.app
902
+ *.i*86
903
+ *.x86_64
904
+ *.hex
905
+
906
+
907
+ ### Vagrant template
908
+ # General
909
+ .vagrant/
910
+
911
+ # Log files (if you are creating logs in debug mode, uncomment this)
912
+ # *.log
913
+
914
+ ### PuTTY template
915
+ # Private key
916
+ *.ppk
917
+
918
+ ### Patch template
919
+ *.orig
920
+ *.rej
921
+
922
+ ### Python template
923
+ # Byte-compiled / optimized / DLL files
924
+ __pycache__/
925
+ *.py[cod]
926
+ *$py.class
927
+
928
+ # C extensions
929
+ *.so
930
+
931
+ # Distribution / packaging
932
+ .Python
933
+ build/
934
+ develop-eggs/
935
+ /dist
936
+ wheelhouse/
937
+ downloads/
938
+ eggs/
939
+ .eggs/
940
+ lib/
941
+ lib64/
942
+ parts/
943
+ sdist/
944
+ var/
945
+ wheels/
946
+ share/python-wheels/
947
+ *.egg-info/
948
+ .installed.cfg
949
+ *.egg
950
+ MANIFEST
951
+
952
+ # PyInstaller
953
+ # Usually these files are written by a python script from a template
954
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
955
+ *.manifest
956
+ *.spec
957
+
958
+ # Installer logs
959
+ pip-log.txt
960
+ pip-delete-this-directory.txt
961
+
962
+ # Unit test / coverage reports
963
+ htmlcov/
964
+ .tox/
965
+ .nox/
966
+ .coverage
967
+ .coverage.*
968
+ .cache
969
+ nosetests.xml
970
+ coverage.xml
971
+ *.cover
972
+ *.py,cover
973
+ .hypothesis/
974
+ .pytest_cache/
975
+ cover/
976
+
977
+ # Translations
978
+ *.mo
979
+ *.pot
980
+
981
+ # Django stuff:
982
+ *.log
983
+ local_settings.py
984
+ db.sqlite3
985
+ db.sqlite3-journal
986
+
987
+ # Flask stuff:
988
+ instance/
989
+ .webassets-cache
990
+
991
+ # Scrapy stuff:
992
+ .scrapy
993
+
994
+ # Sphinx documentation
995
+ docs/_build/
996
+
997
+ # PyBuilder
998
+ .pybuilder/
999
+ target/
1000
+
1001
+ # Jupyter Notebook
1002
+ .ipynb_checkpoints
1003
+
1004
+ # IPython
1005
+ profile_default/
1006
+ ipython_config.py
1007
+
1008
+ # pyenv
1009
+ # For a library or package, you might want to ignore these files since the code is
1010
+ # intended to run in multiple environments; otherwise, check them in:
1011
+ # .python-version
1012
+
1013
+ # pipenv
1014
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
1015
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
1016
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
1017
+ # install all needed dependencies.
1018
+ #Pipfile.lock
1019
+
1020
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
1021
+ __pypackages__/
1022
+
1023
+ # Celery stuff
1024
+ celerybeat-schedule
1025
+ celerybeat.pid
1026
+
1027
+ # SageMath parsed files
1028
+ *.sage.py
1029
+
1030
+ # Environments
1031
+ .env
1032
+ .venv
1033
+ /env/
1034
+ venv/
1035
+ ENV/
1036
+ env.bak/
1037
+ venv.bak/
1038
+
1039
+ # Spyder project settings
1040
+ .spyderproject
1041
+ .spyproject
1042
+
1043
+ # Rope project settings
1044
+ .ropeproject
1045
+
1046
+ # mkdocs documentation
1047
+ /site
1048
+
1049
+ # mypy
1050
+ .mypy_cache/
1051
+ .dmypy.json
1052
+ dmypy.json
1053
+
1054
+ # Pyre type checker
1055
+ .pyre/
1056
+
1057
+ # pytype static type analyzer
1058
+ .pytype/
1059
+
1060
+ # Cython debug symbols
1061
+ cython_debug/
1062
+
1063
+ ### Windows template
1064
+ # Windows thumbnail cache files
1065
+ Thumbs.db
1066
+ Thumbs.db:encryptable
1067
+ ehthumbs.db
1068
+ ehthumbs_vista.db
1069
+
1070
+ # Dump file
1071
+ *.stackdump
1072
+
1073
+ # Folder config file
1074
+ [Dd]esktop.ini
1075
+
1076
+ # Recycle Bin used on file shares
1077
+ $RECYCLE.BIN/
1078
+
1079
+ # Windows Installer files
1080
+ *.cab
1081
+ *.msi
1082
+ *.msix
1083
+ *.msm
1084
+ *.msp
1085
+
1086
+ # Windows shortcuts
1087
+ *.lnk
1088
+
1089
+ ### Xcode template
1090
+ # Xcode
1091
+ #
1092
+ # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
1093
+
1094
+ ## User settings
1095
+ xcuserdata/
1096
+
1097
+ ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
1098
+ *.xcscmblueprint
1099
+ *.xccheckout
1100
+
1101
+ ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
1102
+ build/
1103
+ DerivedData/
1104
+ *.moved-aside
1105
+ *.pbxuser
1106
+ !default.pbxuser
1107
+ *.mode1v3
1108
+ !default.mode1v3
1109
+ *.mode2v3
1110
+ !default.mode2v3
1111
+ *.perspectivev3
1112
+ !default.perspectivev3
1113
+
1114
+ ## Gcc Patch
1115
+ /*.gcno
1116
+
1117
+ ### JetBrains template
1118
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
1119
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
1120
+
1121
+ # User-specific stuff
1122
+ .idea/**/workspace.xml
1123
+ .idea/**/tasks.xml
1124
+ .idea/**/usage.statistics.xml
1125
+ .idea/**/dictionaries
1126
+ .idea/**/shelf
1127
+
1128
+ # Generated files
1129
+ .idea/**/contentModel.xml
1130
+
1131
+ # Sensitive or high-churn files
1132
+ .idea/**/dataSources/
1133
+ .idea/**/dataSources.ids
1134
+ .idea/**/dataSources.local.xml
1135
+ .idea/**/sqlDataSources.xml
1136
+ .idea/**/dynamic.xml
1137
+ .idea/**/uiDesigner.xml
1138
+ .idea/**/dbnavigator.xml
1139
+
1140
+ # Gradle
1141
+ .idea/**/gradle.xml
1142
+ .idea/**/libraries
1143
+
1144
+ # Gradle and Maven with auto-import
1145
+ # When using Gradle or Maven with auto-import, you should exclude module files,
1146
+ # since they will be recreated, and may cause churn. Uncomment if using
1147
+ # auto-import.
1148
+ # .idea/artifacts
1149
+ # .idea/compiler.xml
1150
+ # .idea/jarRepositories.xml
1151
+ # .idea/modules.xml
1152
+ # .idea/*.iml
1153
+ # .idea/modules
1154
+ # *.iml
1155
+ # *.ipr
1156
+
1157
+ # CMake
1158
+ cmake-build-*/
1159
+
1160
+ # Mongo Explorer plugin
1161
+ .idea/**/mongoSettings.xml
1162
+
1163
+ # File-based project format
1164
+ *.iws
1165
+
1166
+ # IntelliJ
1167
+ out/
1168
+
1169
+ # mpeltonen/sbt-idea plugin
1170
+ .idea_modules/
1171
+
1172
+ # JIRA plugin
1173
+ atlassian-ide-plugin.xml
1174
+
1175
+ # Cursive Clojure plugin
1176
+ .idea/replstate.xml
1177
+
1178
+ # Crashlytics plugin (for Android Studio and IntelliJ)
1179
+ com_crashlytics_export_strings.xml
1180
+ crashlytics.properties
1181
+ crashlytics-build.properties
1182
+ fabric.properties
1183
+
1184
+ # Editor-based Rest Client
1185
+ .idea/httpRequests
1186
+
1187
+ # Android studio 3.1+ serialized cache file
1188
+ .idea/caches/build_file_checksums.ser
1189
+
1190
+ /test_*
1191
+ .python-version
1192
+ /docs/build
1193
+ /public
1194
+ /docs/source/**/*.puml.svg
1195
+ /docs/source/**/*.puml.png
1196
+ /docs/source/**/*.gv.svg
1197
+ /docs/source/**/*.gv.png
1198
+ /docs/source/**/*.py.txt
1199
+ /docs/source/**/*.py.err
1200
+ /docs/source/**/*.py.exitcode
1201
+ /docs/source/**/*.sh.txt
1202
+ /docs/source/**/*.sh.err
1203
+ /docs/source/**/*.sh.exitcode
1204
+ /docs/source/**/*.dat.*
1205
+ !/docs/source/_static/**/*
1206
+ /cartpole_dqn_*
1207
+ /extra
1208
+ /resource/yolort/*
1209
+ !/resource/yolort/Makefile
1210
+ /images
1211
+ /output
1212
+ /ckpt
1213
+ /ckpts
1214
+ /.benchmarks
1215
+ /onnxs
1216
+ /.temp
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 😻
4
  colorFrom: indigo
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 3.34.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
4
  colorFrom: indigo
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 3.18.0
8
  app_file: app.py
9
  pinned: false
10
  license: mit
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ import gradio as gr
4
+
5
+ from cls import _CLS_MODELS, _DEFAULT_CLS_MODEL, _gr_classification
6
+
7
+ if __name__ == '__main__':
8
+ with gr.Blocks() as demo:
9
+ with gr.Tabs():
10
+ with gr.Tab('Classification'):
11
+ with gr.Row():
12
+ with gr.Column():
13
+ gr_cls_input_image = gr.Image(type='pil', label='Original Image')
14
+ gr_cls_model = gr.Dropdown(_CLS_MODELS, value=_DEFAULT_CLS_MODEL, label='Model')
15
+ gr_cls_infer_size = gr.Slider(224, 640, value=384, step=32, label='Infer Size')
16
+ gr_cls_submit = gr.Button(value='Submit', variant='primary')
17
+
18
+ with gr.Column():
19
+ gr_cls_output = gr.Label(label='Classes')
20
+
21
+ gr_cls_submit.click(
22
+ _gr_classification,
23
+ inputs=[gr_cls_input_image, gr_cls_model, gr_cls_infer_size],
24
+ outputs=[gr_cls_output],
25
+ )
26
+
27
+ demo.queue(os.cpu_count()).launch()
cls.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from functools import lru_cache
2
+ from typing import Mapping
3
+
4
+ from huggingface_hub import hf_hub_download
5
+ from imgutils.data import ImageTyping, load_image
6
+
7
+ from onnx_ import _open_onnx_model
8
+ from preprocess import _img_encode
9
+
10
+ _LABELS = ['3d', 'bangumi', 'comic', 'illustration']
11
+ _CLS_MODELS = [
12
+ 'caformer_s36',
13
+ 'caformer_s36_plus',
14
+ 'mobilenetv3',
15
+ 'mobilenetv3_dist',
16
+ 'mobilenetv3_sce',
17
+ 'mobilenetv3_sce_dist',
18
+ 'mobilevitv2_150',
19
+ ]
20
+ _DEFAULT_CLS_MODEL = 'mobilenetv3_sce_dist'
21
+
22
+
23
+ @lru_cache()
24
+ def _open_anime_classify_model(model_name):
25
+ return _open_onnx_model(hf_hub_download(
26
+ f'deepghs/anime_classification',
27
+ f'{model_name}/model.onnx',
28
+ ))
29
+
30
+
31
+ def _gr_classification(image: ImageTyping, model_name: str, size=384) -> Mapping[str, float]:
32
+ image = load_image(image, mode='RGB')
33
+ input_ = _img_encode(image, size=(size, size))[None, ...]
34
+ output, = _open_anime_classify_model(model_name).run(['output'], {'input': input_})
35
+
36
+ values = dict(zip(_LABELS, map(lambda x: x.item(), output[0])))
37
+ return values
onnx_.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import os
3
+ import shutil
4
+ from functools import lru_cache
5
+ from typing import Optional
6
+
7
+ from hbutils.system import pip_install
8
+
9
+
10
+ def _ensure_onnxruntime():
11
+ try:
12
+ import onnxruntime
13
+ except (ImportError, ModuleNotFoundError):
14
+ logging.warning('Onnx runtime not installed, preparing to install ...')
15
+ if shutil.which('nvidia-smi'):
16
+ logging.info('Installing onnxruntime-gpu ...')
17
+ pip_install(['onnxruntime-gpu'], silent=True)
18
+ else:
19
+ logging.info('Installing onnxruntime (cpu) ...')
20
+ pip_install(['onnxruntime'], silent=True)
21
+
22
+
23
+ _ensure_onnxruntime()
24
+ from onnxruntime import get_available_providers, get_all_providers, InferenceSession, SessionOptions, \
25
+ GraphOptimizationLevel
26
+
27
+ alias = {
28
+ 'gpu': "CUDAExecutionProvider",
29
+ "trt": "TensorrtExecutionProvider",
30
+ }
31
+
32
+
33
+ def get_onnx_provider(provider: Optional[str] = None):
34
+ if not provider:
35
+ if "CUDAExecutionProvider" in get_available_providers():
36
+ return "CUDAExecutionProvider"
37
+ else:
38
+ return "CPUExecutionProvider"
39
+ elif provider.lower() in alias:
40
+ return alias[provider.lower()]
41
+ else:
42
+ for p in get_all_providers():
43
+ if provider.lower() == p.lower() or f'{provider}ExecutionProvider'.lower() == p.lower():
44
+ return p
45
+
46
+ raise ValueError(f'One of the {get_all_providers()!r} expected, '
47
+ f'but unsupported provider {provider!r} found.')
48
+
49
+
50
+ @lru_cache()
51
+ def _open_onnx_model(ckpt: str, provider: str = None) -> InferenceSession:
52
+ options = SessionOptions()
53
+ options.graph_optimization_level = GraphOptimizationLevel.ORT_ENABLE_ALL
54
+ provider = provider or get_onnx_provider()
55
+ if provider == "CPUExecutionProvider":
56
+ options.intra_op_num_threads = os.cpu_count()
57
+
58
+ logging.info(f'Model {ckpt!r} loaded with provider {provider!r}')
59
+ return InferenceSession(ckpt, options, [provider])
preprocess.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Tuple, Optional
2
+
3
+ import numpy as np
4
+ from PIL import Image
5
+ from imgutils.data import rgb_encode
6
+
7
+
8
+ def _img_encode(image: Image.Image, size: Tuple[int, int] = (384, 384),
9
+ normalize: Optional[Tuple[float, float]] = (0.5, 0.5)):
10
+ image = image.resize(size, Image.BILINEAR)
11
+ data = rgb_encode(image, order_='CHW')
12
+
13
+ if normalize is not None:
14
+ mean_, std_ = normalize
15
+ mean = np.asarray([mean_]).reshape((-1, 1, 1))
16
+ std = np.asarray([std_]).reshape((-1, 1, 1))
17
+ data = (data - mean) / std
18
+
19
+ return data.astype(np.float32)
requirements.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ gradio==3.18.0
2
+ numpy
3
+ pillow
4
+ onnxruntime
5
+ huggingface_hub
6
+ scikit-image
7
+ pandas
8
+ opencv-python>=4.6.0
9
+ hbutils>=0.9.0
10
+ dghs-imgutils>=0.1.0
11
+ httpx==0.23.0