paddlex_restful_demo.html 127 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506
  1. <!--
  2. # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. -->
  16. <!doctype html>
  17. <html>
  18. <head>
  19. <meta charset="utf-8">
  20. <title>欢迎使用 PaddleX RestfulAPI Demo示例程序</title>
  21. <style type="text/css">
  22. h1{
  23. font:400 40px 'pt sans',sans-serif;
  24. text-align:center;
  25. }
  26. .nav a{
  27. text-decoration:none;
  28. }
  29. .nav{
  30. height:70px;
  31. background:#0000cd;
  32. position:relative;
  33. z-index:6;
  34. }
  35. .nav>ul{
  36. position:relative;
  37. list-style:none;
  38. padding:0;
  39. margin:0;
  40. }
  41. .nav>ul>li>ul{
  42. position:absolute;
  43. left:0;
  44. padding:0;
  45. margin:0;
  46. list-style:none;
  47. }
  48. .nav>ul>li:hover>ul li a{
  49. opacity:1;
  50. height:50px;
  51. transition:all .3s linear;
  52. -o-transition:all .3s linear;
  53. -moz-transition:all .3s linear;
  54. -webkit-transition:all .3s linear;
  55. }
  56. .nav>ul>li>ul a{
  57. display:block;
  58. color:#222;
  59. width:150px;
  60. line-height:50px !important;
  61. font:700 16px 'pt sans',sans-serif;
  62. background:#eee;
  63. border-bottom:1px solid #ddd;
  64. text-align:center;
  65. padding:0 5px;
  66. height:0;
  67. overflow:hidden;
  68. opacity:0;
  69. transition:all .3s linear .2s;
  70. -o-transition:all .3s linear .2s;
  71. -moz-transition:all .3s linear .2s;
  72. -webkit-transition:all .3s linear .2s;
  73. }
  74. .nav>ul>li>ul a:hover{
  75. display:block;
  76. color:#222;
  77. width:150px;
  78. line-height:50px !important;
  79. font:700 16px 'pt sans',sans-serif;
  80. background:#A8D9FF;
  81. border-bottom:1px solid #ddd;
  82. text-align:center;
  83. padding:0 5px;
  84. height:0;
  85. overflow:hidden;
  86. opacity:0;
  87. transition:all .3s linear .2s;
  88. -o-transition:all .3s linear .2s;
  89. -moz-transition:all .3s linear .2s;
  90. -webkit-transition:all .3s linear .2s;
  91. }
  92. .nav>ul>li{
  93. float:left;
  94. position:relative;
  95. }
  96. .nav>ul>li>a{
  97. padding:0 20px;
  98. color:#fff;
  99. display:block;
  100. line-height:70px !important;
  101. font:400 15px 'PT Sans', sans-serif;
  102. text-decoration:none;
  103. }
  104. .lamp span{
  105. display:block;
  106. height:4px;
  107. background:#ee6666;
  108. position: relative;
  109. }
  110. .lamp span:after {
  111. bottom: 100%;
  112. left: 50%;
  113. border: solid transparent;
  114. content: " ";
  115. height: 0;
  116. width: 0;
  117. position: absolute;
  118. pointer-events: none;
  119. border-color: rgba(238, 102, 102, 0);
  120. border-bottom-color: #ee6666;
  121. border-width: 4px;
  122. margin-left: -4px;
  123. }
  124. .lamp{
  125. position:absolute !important;
  126. height:4px;
  127. top:66px;
  128. background:#333;
  129. transition:all .3s linear;
  130. -o-transition:all .3s linear;
  131. -moz-transition:all .3s linear;
  132. -webkit-transition:all .3s linear;
  133. }
  134. .selected.active>a,.active>a{
  135. transition:all .3s linear;
  136. -o-transition:all .3s linear;
  137. -moz-transition:all .3s linear;
  138. -webkit-transition:all .3s linear;
  139. color:#fff;
  140. }
  141. .credit{
  142. text-align:center;
  143. margin:20px 0;
  144. }
  145. .blog-link{
  146. color:#fff;
  147. text-decoration:none;
  148. background:#eee;
  149. background-size:40px;
  150. line-height:50px;
  151. display:inline-block;
  152. padding:0 10px;
  153. border-radius:px;
  154. border-bottom:3px solid #ddd;
  155. color:#333;
  156. font-family:'open sans',sans-serif;
  157. margin:10px;
  158. }
  159. .dgithub{
  160. color:#fff;
  161. text-decoration:none;
  162. background-size:40px;
  163. line-height:50px;
  164. display:inline-block;
  165. padding:0 10px 0 50px;
  166. background-position:5px;
  167. border-radius:4px;
  168. border-bottom:3px solid #ddd;
  169. color:#333;
  170. font-family:'open sans',sans-serif;
  171. margin:10px;
  172. }
  173. #draw-border {
  174. display: flex;
  175. align-items: center;
  176. justify-content: center;
  177. height: 10vh;
  178. }
  179. view_item {
  180. border: 1px solid;
  181. background: none;
  182. width: 300px;
  183. height:170px;
  184. text-transform: uppercase;
  185. text-align:left;
  186. color: #4361ee;
  187. font-weight: bold;
  188. position: relative;
  189. outline: none;
  190. padding: 10px 10px;
  191. box-sizing: border-box;
  192. border-radius: 8px;
  193. cursor: pointer;
  194. value: "";
  195. }
  196. view_item::before, view_item::after {
  197. box-sizing: inherit;
  198. position: absolute;
  199. content: '';
  200. border: 2px solid transparent;
  201. width: 0;
  202. height: 0;
  203. border-radius: 6px;
  204. }
  205. view_item::after {
  206. bottom: 0;
  207. right: 0;
  208. }
  209. view_item::before {
  210. top: 0;
  211. left: 0;
  212. }
  213. view_item:hover::before, view_item:hover::after {
  214. width: 100%;
  215. height: 100%;
  216. }
  217. view_item:hover::before {
  218. border-top-color: #4361ee;
  219. border-right-color: #4361ee;
  220. transition: width 0s ease-out, height 0s ease-out 0s;
  221. }
  222. view_item:hover::after {
  223. border-bottom-color: #4361ee;
  224. border-left-color: #4361ee;
  225. transition: border-color 0s ease-out 0s, width 0s ease-out 0s, height 0s ease-out 0s;
  226. }
  227. body { background: #f6f6f6;}
  228. .btn {
  229. width: 120px;
  230. height: 40px;
  231. display: inline-block;
  232. //padding: 2px;
  233. border-radius: 10px;
  234. vertical-align: middle;
  235. background: #0000cd;
  236. //background: linear-gradient(268deg,#e3164e,#7f1ba7,#841c39,#e993e7,#d27228);
  237. background-size: 1000% 1000%;
  238. -webkit-animation: gradient 10s ease infinite;
  239. -moz-animation: gradient 10s ease infinite;
  240. -o-animation: Agradient 10s ease infinite;
  241. animation: gradient 10s ease infinite;
  242. }
  243. .btn input {
  244. font: 300 14px/14px 'Source Sans Pro',sans-serif;
  245. letter-spacing: 1px;
  246. display: block;
  247. position: relative;
  248. width: 100%;
  249. height: 100%;
  250. text-transform: uppercase;
  251. background: #0000cd;
  252. border: none;
  253. outline: none;
  254. border-radius: 10px;
  255. color: #f6f6f6;
  256. cursor: pointer;
  257. transition: all 0.3s cubic-bezier(0.645,0.045,0.355,1)
  258. }
  259. .btn:hover input {
  260. background: transparent;
  261. color: #f6f6f6;
  262. letter-spacing: 1px;
  263. outline: 1px;
  264. background: #0000e7;
  265. }
  266. .btn-toggle-mx {
  267. -webkit-transform: rotateY(0deg);
  268. transform: rotateY(0deg);
  269. -webkit-transition: 0.8s all;
  270. -o-transition: 0.8s all;
  271. transition: 0.8s all
  272. }
  273. .btn-toggle-mx.transmx {
  274. -webkit-transform: rotateY(180deg);
  275. transform: rotateY(180deg);
  276. }
  277. .progress {
  278. height:20px;
  279. background:#ebebeb;
  280. border-left:1px solid transparent;
  281. border-right:1px solid transparent;
  282. border-radius:10px;
  283. }
  284. .progress > span {
  285. position:relative;
  286. float:left;
  287. margin:0 -1px;
  288. min-width:30px;
  289. height:18px;
  290. line-height:16px;
  291. text-align:right;
  292. background:#cccccc;
  293. border:1px solid;
  294. border-color:#bfbfbf #b3b3b3 #9e9e9e;
  295. border-radius:10px;
  296. background-image:-webkit-linear-gradient(top,#f0f0f0 0%,#dbdbdb 70%,#cccccc 100%);
  297. background-image:-moz-linear-gradient(top,#f0f0f0 0%,#dbdbdb 70%,#cccccc 100%);
  298. background-image:-o-linear-gradient(top,#f0f0f0 0%,#dbdbdb 70%,#cccccc 100%);
  299. background-image:linear-gradient(to bottom,#f0f0f0 0%,#dbdbdb 70%,#cccccc 100%);
  300. -webkit-box-shadow:inset 0 1px rgba(255,255,255,0.3),0 1px 2px rgba(0,0,0,0.2);
  301. box-shadow:inset 0 1px rgba(255,255,255,0.3),0 1px 2px rgba(0,0,0,0.2);
  302. }
  303. .progress > span > span {
  304. padding:0 8px;
  305. font-size:9px;
  306. font-weight:bold;
  307. color:#404040;
  308. color:rgba(0,0,0,0.7);
  309. text-shadow:0 1px rgba(255,255,255,0.4);
  310. }
  311. .progress > span:before {
  312. content:'';
  313. position:absolute;
  314. top:0;
  315. bottom:0;
  316. left:0;
  317. right:0;
  318. z-index:1;
  319. height:18px;
  320. border-radius:10px;
  321. }
  322. .progress .green {
  323. background:#85c440;
  324. border-color:#78b337 #6ba031 #568128;
  325. background-image:-webkit-linear-gradient(top,#b7dc8e 0%,#99ce5f 70%,#85c440 100%);
  326. background-image:-moz-linear-gradient(top,#b7dc8e 0%,#99ce5f 70%,#85c440 100%);
  327. background-image:-o-linear-gradient(top,#b7dc8e 0%,#99ce5f 70%,#85c440 100%);
  328. background-image:linear-gradient(to bottom,#b7dc8e 0%,#99ce5f 70%,#85c440 100%);
  329. }
  330. .progress .blue {
  331. background:#5aaadb;
  332. border-color:#459fd6 #3094d2 #277db2;
  333. background-image:-webkit-linear-gradient(top,#aed5ed 0%,#7bbbe2 70%,#5aaadb 100%);
  334. background-image:-moz-linear-gradient(top,#aed5ed 0%,#7bbbe2 70%,#5aaadb 100%);
  335. background-image:-o-linear-gradient(top,#aed5ed 0%,#7bbbe2 70%,#5aaadb 100%);
  336. background-image:linear-gradient(to bottom,#aed5ed 0%,#7bbbe2 70%,#5aaadb 100%);
  337. }
  338. #popupmenu_project{
  339. border:1px solid #ddd;
  340. background: #eee;
  341. position: absolute;
  342. width: 200px;
  343. height: 140px;
  344. display: none;
  345. z-index:8;
  346. }
  347. .popupmenu_project tr:hover{background:#A8D9FF;}
  348. #popupmenu_dataset{
  349. border:1px solid #ddd;
  350. background: #eee;
  351. position: absolute;
  352. width: 200px;
  353. height: 50px;
  354. display: none;
  355. z-index:8;
  356. }
  357. .popupmenu_dataset tr:hover{background:#A8D9FF;}
  358. #popupmenu_task{
  359. border:1px solid #ddd;
  360. background: #eee;
  361. position: absolute;
  362. width: 200px;
  363. height: 50px;
  364. display: none;
  365. z-index:8;
  366. }
  367. .popupmenu_task tr:hover{background:#A8D9FF;}
  368. #popupmenu_model{
  369. border:1px solid #ddd;
  370. background: #eee;
  371. position: absolute;
  372. width: 200px;
  373. height: 50px;
  374. display: none;
  375. z-index:8;
  376. }
  377. .popupmenu_model tr:hover{background:#A8D9FF;}
  378. .scroll-content{
  379. height: 220px;
  380. }
  381. .table-parms-head{padding-right:17px;background-color:#999;color:#000;}
  382. .table-parms-head table,.table-body table{width:100%;}
  383. .table-parms-body{width:100%; height:210px;overflow-y:scroll;}
  384. .table-parms-body table tr:nth-child(2n+1){background-color:#f2f2f2;}
  385. .table-dataset-labels{width:100%; height:210px; border:1px solid #D6D6D6; overflow-y:scroll; padding:0px 0px;}
  386. .table-dataset-labels table tr:nth-child(2n){background-color:#f2f2f2; padding:0px 0px;}
  387. .table-dataset-labels table td{border:solid #f2f2f2; border-width:0px 1px 1px 0px; padding:0px 0px;}
  388. .table-dataset-imgs{width:100%; height:210px; border:1px solid #D6D6D6; overflow-y:scroll;}
  389. </style>
  390. <script type="text/javascript">
  391. //server url address
  392. var str_srv_url = "http://0.0.0.0:8080";
  393. //数据集选择列表,用于创建项目时下拉选择
  394. var g_dataset_list = {};
  395. //创建任务时任务参数dic
  396. var g_train_task_parms = {};
  397. //保存刷新项目任务时需要使用的项目id及type
  398. var g_view_project_task_id = "";
  399. var g_view_project_task_type = "classification";
  400. //用于刷新任务定时器句柄
  401. var g_instance_refresh_clock;
  402. //浏览数据集变量
  403. var g_dataset_files = {};
  404. //记录当前页
  405. var g_current_dataset_page = 1;
  406. //每页显示几张图片
  407. var g_const_imgs_per_page = 3;
  408. //当前标签
  409. var g_current_dataset_lable_name = "";
  410. //是否显示标注
  411. var g_b_show_img_labels = false;
  412. //数据集状态
  413. var DatasetStatus = {
  414. XEMPTY:0, //空数据集
  415. XCHECKING:1, //正在验证数据集
  416. XCHECKFAIL:2, //数据集验证失败
  417. XCOPYING:3, //正在导入数据集
  418. XCOPYDONE:4, //数据集导入成功
  419. XCOPYFAIL:5, //数据集导入失败
  420. XSPLITED:6 //数据集已经切分
  421. };
  422. //任务状态
  423. var TaskStatus = {
  424. XUNINIT:0, //任务还未初始化
  425. XINIT:1, //任务初始化
  426. XDOWNLOADING:2, //正在下载预训练模型
  427. XTRAINING:3, //任务正在运行中,该状态下任务不能被删除
  428. XTRAINDONE:4, //任务完成运行
  429. XEVALUATED:5, //任务评估完成
  430. XEXPORTING:6, //任务正在导出inference模型
  431. XEXPORTED:7, //任务已经导出模型
  432. XTRAINEXIT:8, //任务运行中止
  433. XDOWNLOADFAIL:9, //任务下载失败
  434. XTRAINFAIL:10, //任务运行失败
  435. XEVALUATING:11, //任务评估中
  436. XEVALUATEFAIL:12, //任务评估失败
  437. XEXPORTFAIL:13, //任务导出模型失败
  438. XPRUNEING:14, //裁剪分析任务运行中
  439. XPRUNETRAIN:15 //裁剪训练任务运行中
  440. };
  441. //参数范围
  442. var Model_List = {
  443. "classification":["MobileNetV2", "ResNet18", "ResNet34", "ResNet50", "ResNet101",
  444. "ResNet50_vd", "ResNet101_vd", "ResNet50_vd_ssld", "ResNet101_vd_ssld",
  445. "DarkNet53", "MobileNetV1", "MobileNetV3_small", "MobileNetV3_large",
  446. "MobileNetV3_small_ssld", "MobileNetV3_large_ssld", "Xception41",
  447. "Xception65", "DenseNet121", "DenseNet161", "DenseNet201","ShuffleNetV2"],
  448. "detection":["YOLOv3", "FasterRCNN", "PPYOLO"],
  449. "instance_segmentation":["DeepLabv3+", "U-Net", "HRNet_W18", "FastSCNN"],
  450. "segmentation":["MaskRCNN"]
  451. }
  452. var Backbone_List = {
  453. "YOLOv3": ["DarkNet53", "ResNet34", "MobileNetV1", "MobileNetV3_large"],
  454. "PPYOLO": ["ResNet50_vd_ssld"],
  455. "FasterRCNN": ["ResNet18", "ResNet50", "ResNet50_vd", "ResNet101", "ResNet101_vd", "HRNet_W18"],
  456. "DeepLabv3p": ["Xception65", "Xception41", "MobileNetV3_large_x1_0_ssld", "MobileNetV2_x0.25",
  457. "MobileNetV2_x0.5", "MobileNetV2_x1.0", "MobileNetV2_x1.5","MobileNetV2_x2.0"],
  458. "MaskRCNN": ["ResNet18", "ResNet50", "ResNet50_vd", "ResNet101", "ResNet101_vd", "HRNet_W18"]
  459. }
  460. //显示服务器配置窗口
  461. function show_server_info(input_data)
  462. {
  463. var srv_url_text = document.getElementById('server_url_text');
  464. srv_url_text.value = str_srv_url;
  465. var input_crt_prj_win = document.getElementById('input_win_cfg_server');
  466. var input_crt_prj_win_over = document.getElementById('input_win_cfg_server_over');
  467. input_crt_prj_win.style.display = "block";
  468. input_crt_prj_win_over.style.display = "block";
  469. }
  470. //隐藏服务器配置窗口
  471. function hide_server_info(input_data)
  472. {
  473. var on_win_user = document.getElementById('input_win_cfg_server');
  474. var over_win_user = document.getElementById('input_win_cfg_server_over');
  475. on_win_user.style.display = "none";
  476. over_win_user.style.display = "none";
  477. }
  478. //创建项目弹出窗口
  479. function show_create_project_win_modal(obj)
  480. {
  481. var prj_name_text = document.getElementById('project_name_text');
  482. project_name_text.value='新建项目';
  483. //加载项目对应的数据集列表
  484. str_project_type = "classification";
  485. var obj_sel_create_project_type = document.getElementById('project_type_text');
  486. obj_sel_create_project_type.value=str_project_type;
  487. //加载数据集信息及默认参数
  488. var obj_sel_create_project_dataset_id = document.getElementById('create_project_dataset_id_text');
  489. obj_sel_create_project_dataset_id.options.length = 0
  490. obj_sel_create_project_dataset_id.options[0] = new Option("请选择项目对应数据集", 0);
  491. var http_request = new XMLHttpRequest();
  492. http_request.open("GET", str_srv_url + "/dataset", false);
  493. http_request.send(null);
  494. str_json_datasets = http_request.responseText;
  495. //取出对应类型的数据集
  496. var str_json = eval('(' + str_json_datasets + ')');
  497. var obj_datasets = str_json["datasets"];
  498. g_dataset_list = obj_datasets;
  499. for(var p in obj_datasets)
  500. {
  501. str_id = obj_datasets[p].id;
  502. str_attr = obj_datasets[p].attr;
  503. str_name = str_attr["name"];
  504. str_desc = str_attr["desc"];
  505. str_type = str_attr["type"];
  506. //str_crttime = str_attr["create_time"]
  507. str_status = str_attr["dataset_status"]
  508. if(str_status == DatasetStatus.XSPLITED && str_type == str_project_type)
  509. {
  510. obj_sel_create_project_dataset_id.options[obj_sel_create_project_dataset_id.options.length] = new Option(str_name, str_id);
  511. }
  512. }
  513. var input_crt_prj_win = document.getElementById('input_win_create_project');
  514. var input_crt_prj_win_over = document.getElementById('input_win_create_project_over');
  515. input_crt_prj_win.style.display = "block";
  516. input_crt_prj_win_over.style.display = "block";
  517. }
  518. //隐藏创建项目弹出窗口
  519. function hide_create_prj_win_modal(obj)
  520. {
  521. var on_win_create_prj = document.getElementById('input_win_create_project');
  522. var over_win_create_prj = document.getElementById('input_win_create_project_over');
  523. on_win_create_prj.style.display = "none";
  524. over_win_create_prj.style.display = "none";
  525. }
  526. //显示创建数据集弹出窗口
  527. function show_create_dataset_win_modal(obj)
  528. {
  529. var dataset_name_text = document.getElementById('dataset_name_text');
  530. dataset_name_text.value='新建数据集';
  531. var input_crt_dataset_win = document.getElementById('input_win_create_dataset');
  532. var input_crt_dataset_win_over = document.getElementById('input_win_create_dataset_over');
  533. input_crt_dataset_win.style.display = "block";
  534. input_crt_dataset_win_over.style.display = "block";
  535. }
  536. //隐藏创建数据集弹出窗口
  537. function hide_create_dataset_win_modal(obj)
  538. {
  539. var on_win_create_dataset = document.getElementById('input_win_create_dataset');
  540. var over_win_create_dataset = document.getElementById('input_win_create_dataset_over');
  541. on_win_create_dataset.style.display = "none";
  542. over_win_create_dataset.style.display = "none";
  543. }
  544. //显示导入数据集弹出窗口
  545. function show_import_dataset_win_modal(obj)
  546. {
  547. var on_win_import_dataset = document.getElementById('input_win_import_dataset');
  548. var over_win_import_dataset = document.getElementById('input_win_import_dataset_over');
  549. var input_import_dataset_id = document.getElementById('import_dataset_id');
  550. on_win_import_dataset.style.display = "block";
  551. over_win_import_dataset.style.display = "block";
  552. input_import_dataset_id.value = obj.id;
  553. }
  554. //隐藏导入数据集弹出窗口
  555. function hide_import_dataset_win_modal(obj)
  556. {
  557. var on_win_import_dataset = document.getElementById('input_win_import_dataset');
  558. var over_win_import_dataset = document.getElementById('input_win_import_dataset_over');
  559. var input_import_dataset_id = document.getElementById('import_dataset_id');
  560. on_win_import_dataset.style.display = "none";
  561. over_win_import_dataset.style.display = "none";
  562. input_import_dataset_id.value = "";
  563. }
  564. function re_split_dataset(obj)
  565. {
  566. var on_win_split_dataset = document.getElementById('input_win_split_dataset');
  567. var over_win_split_dataset = document.getElementById('input_win_split_dataset_over');
  568. //获取需要切分的数据集ID
  569. document.getElementById('split_dataset_id').value = document.getElementById('browse_dataset_id').value;
  570. on_win_split_dataset.style.display = "block";
  571. over_win_split_dataset.style.display = "block";
  572. }
  573. //切分数据集弹出窗口
  574. function show_split_dataset_win_modal(obj)
  575. {
  576. var on_win_split_dataset = document.getElementById('input_win_split_dataset');
  577. var over_win_split_dataset = document.getElementById('input_win_split_dataset_over');
  578. var input_split_dataset_id = document.getElementById('split_dataset_id');
  579. on_win_split_dataset.style.display = "block";
  580. over_win_split_dataset.style.display = "block";
  581. input_split_dataset_id.value = obj.id;
  582. }
  583. //隐藏切分数据集弹出窗口
  584. function hide_split_dataset_win_modal(obj)
  585. {
  586. var on_win_split_dataset = document.getElementById('input_win_split_dataset');
  587. var over_win_split_dataset = document.getElementById('input_win_split_dataset_over');
  588. var input_split_dataset_id = document.getElementById('split_dataset_id');
  589. on_win_split_dataset.style.display = "none";
  590. over_win_split_dataset.style.display = "none";
  591. input_split_dataset_id.value = "";
  592. }
  593. //获取数据集详细信息
  594. function get_dataset_detail_info(str_dataset_id)
  595. {
  596. var http_request;
  597. if (window.XMLHttpRequest)
  598. {
  599. http_request=new XMLHttpRequest();
  600. http_request.withCredentials = true;
  601. }
  602. else
  603. {
  604. http_request=new ActiveXObject("Microsoft.XMLHTTP");
  605. }
  606. http_request.open("GET",str_srv_url + "/dataset/details?did=" + str_dataset_id, false);
  607. http_request.send(null);
  608. var str_dataset_detail_info = http_request.responseText;
  609. return str_dataset_detail_info;
  610. }
  611. //加载图片
  612. function load_labels_imgs(str_lbl_name, int_page = 1)
  613. {
  614. var lst_img_files = g_dataset_files[str_lbl_name];
  615. var str_dataset_id = document.getElementById('browse_dataset_id').value;
  616. //获取数据集路径
  617. var str_dataset_path = document.getElementById('view_dataset_path_' + str_dataset_id).value;
  618. var curr_file_idx = g_const_imgs_per_page * (int_page - 1);
  619. var img_count = 0;
  620. for(var j=curr_file_idx;j<lst_img_files.length;j++)
  621. {
  622. var str_img_file_name = lst_img_files[j];
  623. var str_img_file = str_dataset_path + "/" + str_img_file_name;
  624. //是否显示标注
  625. var str_img_file_content = "";
  626. if(g_b_show_img_labels == true)
  627. {
  628. str_img_file_content = get_img_file_from_server(str_img_file, str_dataset_id);
  629. }
  630. else
  631. {
  632. str_img_file_content = get_img_file_from_server(str_img_file);
  633. }
  634. //更新img框内容
  635. img_count = img_count + 1;
  636. var obj_img = document.getElementById('dataset_img_' + img_count);
  637. var idx_file_postfix = str_img_file_name.lastIndexOf(".");
  638. var str_file_type = "jpeg";
  639. if(idx_file_postfix >= 0)
  640. {
  641. str_file_type = str_img_file_name.substring(idx_file_postfix + 1,str_img_file_name.length);
  642. }
  643. str_file_type = str_file_type.toLowerCase();
  644. var str_b64_type = "data:image/jpeg;base64,";
  645. if(str_file_type == "jpg" || str_file_type == "jpeg")
  646. str_b64_type = "data:image/jpeg;base64,";
  647. else if (str_file_type == "bmp")
  648. str_b64_type = "data:image/jpeg;base64,";
  649. else if (str_file_type == "png")
  650. str_b64_type = "data:image/png;base64,";
  651. obj_img.src = str_b64_type + str_img_file_content;
  652. //更新文件名称
  653. var idx_path_split = str_img_file_name.lastIndexOf("/");
  654. var str_img_file_shot_name = str_img_file_name;
  655. if(idx_path_split >= 0)
  656. {
  657. str_img_file_shot_name = str_img_file_name.substring(idx_path_split + 1,str_img_file_name.length);
  658. }
  659. document.getElementById('dataset_img_' + img_count + "_file_name").innerText = str_img_file_shot_name;
  660. if(img_count >= g_const_imgs_per_page)
  661. {
  662. break;
  663. }
  664. }
  665. }
  666. //从服务端请求文件内容
  667. function get_img_file_from_server(str_file_name, str_dataset_id = "")
  668. {
  669. var http_request = new XMLHttpRequest();
  670. if(str_dataset_id == "")
  671. {
  672. http_request.open("GET", str_srv_url + "/file?path=" + str_file_name, false);
  673. }
  674. else
  675. {
  676. http_request.open("GET", str_srv_url + "/file?path=" + str_file_name + "&did=" + str_dataset_id, false);
  677. }
  678. http_request.send(null);
  679. var obj_json = eval('(' + http_request.responseText + ')');
  680. var str_data = obj_json["img_data"];
  681. return str_data;
  682. }
  683. //刷新翻页按纽
  684. function refresh_dataset_page_buttons()
  685. {
  686. var max_page_num = Math.ceil(g_dataset_files[g_current_dataset_lable_name].length / g_const_imgs_per_page);
  687. document.getElementById('dataset_page_info').innerText = "第" + g_current_dataset_page + "页/共" + max_page_num + "页";
  688. }
  689. //加载数据标签信息
  690. function add_labels_to_table(str_lbl_list,dic_file_lst)
  691. {
  692. g_dataset_files = dic_file_lst;
  693. var rows = table_dataset_labels.rows.length;
  694. for (i=rows-1;i>=1;i--)
  695. {
  696. table_dataset_labels.deleteRow(i);
  697. }
  698. for(var j=0;j<str_lbl_list.length;j++)
  699. {
  700. var str_lbl_name = str_lbl_list[j];
  701. var lst_files = dic_file_lst[str_lbl_name];
  702. var rows = table_dataset_labels.rows.length;
  703. var newTr = table_dataset_labels.insertRow(rows);
  704. newTr.id = str_lbl_name;
  705. newTr.onclick=function()
  706. {
  707. g_current_dataset_page = 1;
  708. g_current_dataset_lable_name = this.id;
  709. load_labels_imgs(this.id, g_current_dataset_page);
  710. refresh_dataset_page_buttons();
  711. }
  712. newTr.style.cursor="pointer";
  713. var newTd0=newTr.insertCell();
  714. newTd0.innerText = str_lbl_name;
  715. var newTd1=newTr.insertCell();
  716. newTd1.innerText = lst_files.length;
  717. var newTd2=newTr.insertCell();
  718. newTd2.innerText = "";
  719. var newTd3=newTr.insertCell();
  720. newTd3.innerText = "";
  721. var newTd4=newTr.insertCell();
  722. newTd4.innerText = "";
  723. }
  724. }
  725. //浏览数据集弹出窗口
  726. function show_browse_dataset_win_modal(obj)
  727. {
  728. var on_win_browse_dataset = document.getElementById('win_browse_dataset');
  729. var over_win_browse_dataset = document.getElementById('win_browse_dataset_over');
  730. document.getElementById('browse_dataset_id').value = obj.id;
  731. var str_dataset_details = get_dataset_detail_info(obj.id);
  732. var obj_json_dataset_details = eval('(' + str_dataset_details + ')');
  733. var lst_labels = obj_json_dataset_details["details"]["labels"];
  734. var lst_files = obj_json_dataset_details["details"]["label_info"];
  735. //数据集详情
  736. document.getElementById('browse_dataset_name_text').value = document.getElementById('view_dataset_name_' + obj.id).value;
  737. document.getElementById('browse_dataset_type_text').value = document.getElementById('view_dataset_type_' + obj.id).value;
  738. document.getElementById('browse_dataset_desc_text').value = document.getElementById('view_dataset_desc_' + obj.id).value;
  739. //分类不需要显示标注
  740. if(document.getElementById('browse_dataset_type_text').value == "图像分类")
  741. {
  742. document.getElementById('dataset_chk_show_label').style.visibility = "hidden";
  743. document.getElementById('dataset_chk_show_label_txt').style.visibility = "hidden";
  744. }
  745. else
  746. {
  747. document.getElementById('dataset_chk_show_label').style.visibility = "";
  748. document.getElementById('dataset_chk_show_label_txt').style.visibility = "";
  749. }
  750. //默认不显示标注
  751. g_b_show_img_labels = false;
  752. document.getElementById('dataset_chk_show_label').checked = false;
  753. //刷新标签
  754. add_labels_to_table(lst_labels, lst_files);
  755. //加载预览图片
  756. g_current_dataset_lable_name = lst_labels[0];
  757. load_labels_imgs(lst_labels[0],g_current_dataset_page);
  758. //刷新翻页按纽
  759. refresh_dataset_page_buttons();
  760. on_win_browse_dataset.style.display = "block";
  761. over_win_browse_dataset.style.display = "block";
  762. }
  763. //关闭浏览数据集
  764. function hide_browse_dataset_win_modal(obj)
  765. {
  766. //当前页重置
  767. g_current_dataset_page = 1;
  768. var on_win_browse_dataset = document.getElementById('win_browse_dataset');
  769. var over_win_browse_dataset = document.getElementById('win_browse_dataset_over');
  770. document.getElementById('browse_dataset_id').value = "";
  771. on_win_browse_dataset.style.display = "none";
  772. over_win_browse_dataset.style.display = "none";
  773. }
  774. //双击放大图像
  775. function zoom_image(obj)
  776. {
  777. if(obj.src != "")
  778. {
  779. document.getElementById('dataset_browse_img').src = obj.src;
  780. var on_win_browse_img = document.getElementById('win_browse_img');
  781. var over_win_browse_img = document.getElementById('win_browse_img_over');
  782. on_win_browse_img.style.display = "block";
  783. over_win_browse_img.style.display = "block";
  784. }
  785. }
  786. //放大预览图片
  787. function hide_zoom_img(obj)
  788. {
  789. var on_win_browse_img = document.getElementById('win_browse_img');
  790. var over_win_browse_img = document.getElementById('win_browse_img_over');
  791. on_win_browse_img.style.display = "none";
  792. over_win_browse_img.style.display = "none";
  793. }
  794. //上一页
  795. function dataset_pre_page()
  796. {
  797. g_current_dataset_page = g_current_dataset_page - 1;
  798. if(g_current_dataset_page <= 0)
  799. {
  800. g_current_dataset_page = 1;
  801. }
  802. load_labels_imgs(g_current_dataset_lable_name, g_current_dataset_page);
  803. refresh_dataset_page_buttons()
  804. }
  805. //下一页
  806. function dataset_next_page()
  807. {
  808. g_current_dataset_page = g_current_dataset_page + 1;
  809. //是否大于最大页
  810. if(g_current_dataset_page * g_const_imgs_per_page > g_dataset_files[g_current_dataset_lable_name].length + 2)
  811. {
  812. g_current_dataset_page = g_current_dataset_page - 1;
  813. }
  814. load_labels_imgs(g_current_dataset_lable_name, g_current_dataset_page);
  815. refresh_dataset_page_buttons()
  816. }
  817. //显示标注
  818. function show_dataset_labels()
  819. {
  820. g_b_show_img_labels = !g_b_show_img_labels;
  821. load_labels_imgs(g_current_dataset_lable_name, g_current_dataset_page);
  822. }
  823. //根据任务状态更新任务信息UI
  824. function update_task_detail_info_ui(str_view_task_id, b_get_task_parms = false)
  825. {
  826. //获取任务信息,刷新任务窗口
  827. var http_request = new XMLHttpRequest();
  828. http_request.open("GET", str_srv_url + "/project/task?tid=" + str_view_task_id, false);
  829. http_request.send(null);
  830. var obj_json = eval('(' + http_request.responseText + ')');
  831. var str_task_msg = obj_json["message"];
  832. var str_task_status = obj_json["task_status"];
  833. var running_duration = "NA";
  834. var progress_bar_value = 0;
  835. var str_view_task_status_text = "任务初始化";
  836. var str_task_next_button_lable = "关闭"
  837. var obj_task_next_button = document.getElementById('btn_next_task_info');
  838. //停止任务按纽
  839. var obj_stop_task_div = document.getElementById('div_btn_stop_task');
  840. var b_show_stop_task_btn = false;
  841. if (str_task_status == TaskStatus.XINIT)
  842. {
  843. str_view_task_status_text = "任务初始化";
  844. }
  845. else if (str_task_status == TaskStatus.XTRAINFAIL)
  846. {
  847. str_view_task_status_text = "任务训练失败";
  848. }
  849. else if (str_task_status == TaskStatus.XTRAINDONE)
  850. {
  851. str_view_task_status_text = "任务训练完成";
  852. progress_bar_value = 100;
  853. str_task_msg = "任务训练完成,请进行模型评估或者导出模型";
  854. //取消按纽更新为评估&导出模型
  855. str_task_next_button_lable = "评估&导出模型";
  856. }
  857. else if (str_task_status == TaskStatus.XTRAINING)
  858. {
  859. str_view_task_status_text = "任务训练中";
  860. b_show_stop_task_btn = true;
  861. //获取任务参数
  862. if(b_get_task_parms == true)
  863. {
  864. var train_parms_http_request = new XMLHttpRequest();
  865. train_parms_http_request.open("GET", str_srv_url + "/project/task/params?tid=" + str_view_task_id, false);
  866. train_parms_http_request.send(null);
  867. var obj_parms_json = eval('(' + train_parms_http_request.responseText + ')');
  868. g_train_task_parms = obj_parms_json["train"];
  869. }
  870. //获取训练状态
  871. var train_http_request = new XMLHttpRequest();
  872. train_http_request.open("GET", str_srv_url + "/project/task/metrics?tid=" + str_view_task_id + "&type=train", false);
  873. train_http_request.send(null);
  874. str_task_msg = train_http_request.responseText;
  875. try
  876. {
  877. var obj_train_msg_json = eval('(' + str_task_msg + ')');
  878. var dic_train_log_metric = obj_train_msg_json["train_log"]["train_metrics"];
  879. running_duration = obj_train_msg_json["train_log"]["running_duration"];
  880. var curr_epoc = dic_train_log_metric["Epoch"];
  881. var curr_step = dic_train_log_metric["Step"];
  882. var curr_acc1 = dic_train_log_metric["acc1"];
  883. var curr_acc5 = dic_train_log_metric["acc5"];
  884. var curr_loss = dic_train_log_metric["loss"];
  885. var curr_lr = dic_train_log_metric["lr"];
  886. //计算进度
  887. var cur_progress = parseInt((parseInt(curr_epoc)-1)/parseInt(g_train_task_parms["num_epochs"]) * 100);
  888. if(cur_progress > 100)
  889. cur_progress = 100;
  890. progress_bar_value = cur_progress;
  891. }
  892. catch(err)
  893. {
  894. str_view_task_status_text = "任务训练中(启动训练中)";
  895. progress_bar_value = 0;
  896. str_task_msg = "任务训练中(启动训练中),请稍等...";
  897. }
  898. //启动定时器,用于定时刷新任务状态
  899. if(b_get_task_parms)
  900. {
  901. g_instance_refresh_clock = self.setInterval("refresh_task_detail_info_win()",1000);
  902. }
  903. }
  904. else if (str_task_status == TaskStatus.XEXPORTING)
  905. {
  906. str_view_task_status_text = "任务训练完成(模型导出中)";
  907. progress_bar_value = 100;
  908. str_task_msg = "任务训练完成(模型导出中),可以重新进行模型评估或者导出模型";
  909. //取消按纽更新为评估&导出模型
  910. str_task_next_button_lable = "评估&导出模型";
  911. }
  912. else if (str_task_status == TaskStatus.XEXPORTED)
  913. {
  914. str_view_task_status_text = "任务训练完成(模型已导出)";
  915. progress_bar_value = 100;
  916. str_task_msg = "任务训练完成(模型已导出),可以重新进行模型评估或者导出模型";
  917. //取消按纽更新为评估&导出模型
  918. str_task_next_button_lable = "评估&导出模型";
  919. }
  920. else if (str_task_status == TaskStatus.XTRAINEXIT)
  921. {
  922. str_view_task_status_text = "任务已中止";
  923. progress_bar_value = 0;
  924. str_task_msg = "任务已中止,可以重新启动模型训练";
  925. //取消按纽更新为评估&导出模型
  926. str_task_next_button_lable = "继续训练";
  927. }
  928. var obj_view_task_status_text = document.getElementById('task_detail_status_text');
  929. obj_view_task_status_text.value = str_view_task_status_text;
  930. var obj_view_task_log_text = document.getElementById('task_detail_log_text');
  931. obj_view_task_log_text.value = str_task_msg;
  932. var obj_view_task_running_duration_text = document.getElementById('task_detail_running_duration_text');
  933. obj_view_task_running_duration_text.value = running_duration;
  934. //进度条
  935. var obj_view_task_status_progress_value = document.getElementById('task_detail_status_progress_bar_value');
  936. obj_view_task_status_progress_value.style = "width: " + progress_bar_value + "%;";
  937. var obj_view_task_status_progress_bar = document.getElementById('task_detail_status_progress_bar');
  938. obj_view_task_status_progress_value.innerText = progress_bar_value + "%";
  939. //按纽标题
  940. obj_task_next_button.value = str_task_next_button_lable;
  941. //停止任务按纽显示
  942. if(b_show_stop_task_btn == true)
  943. {
  944. obj_stop_task_div.style.visibility = "";
  945. }
  946. else
  947. {
  948. obj_stop_task_div.style.visibility = "hidden";
  949. }
  950. }
  951. //显示任务运行状态窗口
  952. function show_task_detail_info_win_modal(obj)
  953. {
  954. var input_task_detail_id = document.getElementById('task_detail_id');
  955. input_task_detail_id.value = obj.id;
  956. //获取任务信息,刷新任务窗口
  957. var str_view_task_id = obj.id;
  958. update_task_detail_info_ui(str_view_task_id, true);
  959. var task_detail_info_win = document.getElementById('task_detail_info');
  960. var task_detail_info_win_over = document.getElementById('task_detail_info_over');
  961. task_detail_info_win.style.display = "block";
  962. task_detail_info_win_over.style.display = "block";
  963. }
  964. //用于定时刷新任务运行状态窗口
  965. function refresh_task_detail_info_win()
  966. {
  967. var input_task_detail_id = document.getElementById('task_detail_id');
  968. var str_view_task_id = input_task_detail_id.value;
  969. update_task_detail_info_ui(str_view_task_id, false);
  970. }
  971. //关闭任务运行信息弹出窗口
  972. function hide_task_detail_info_win_modal()
  973. {
  974. var task_detail_info_win = document.getElementById('task_detail_info');
  975. var task_detail_info_win_over = document.getElementById('task_detail_info_over');
  976. var input_task_detail_id = document.getElementById('task_detail_id');
  977. task_detail_info_win.style.display = "none";
  978. task_detail_info_win_over.style.display = "none";
  979. input_task_detail_id.value = "";
  980. //关闭定时器
  981. g_instance_refresh_clock=window.clearInterval(g_instance_refresh_clock);
  982. }
  983. //模型训练结束下一步处理(模型评估&导出)
  984. function task_next_step_process(obj)
  985. {
  986. var str_btn_label = obj.value;
  987. if(str_btn_label == "关闭")
  988. {
  989. hide_task_detail_info_win_modal();
  990. }
  991. else if(str_btn_label == "评估&导出模型")
  992. {
  993. //启动模型评估
  994. show_evaluate_export_win_modal(obj);
  995. //隐藏原来窗口
  996. hide_task_detail_info_win_modal();
  997. }
  998. else if(str_btn_label == "继续训练")
  999. {
  1000. //重新启动模型训练
  1001. var str_start_tid = "";
  1002. var obj_start_task_id_input = document.getElementById('task_detail_id');
  1003. str_start_tid = obj_start_task_id_input.value;
  1004. start_task(str_start_tid);
  1005. load_tasks();
  1006. //隐藏原来窗口
  1007. hide_task_detail_info_win_modal();
  1008. }
  1009. }
  1010. //打开VDL链接
  1011. function open_task_vdl_window()
  1012. {
  1013. var input_task_detail_id = document.getElementById('task_detail_id');
  1014. var str_view_task_id = input_task_detail_id.value;
  1015. var http_request;
  1016. if (window.XMLHttpRequest)
  1017. {
  1018. http_request=new XMLHttpRequest();
  1019. }
  1020. else
  1021. {
  1022. http_request=new ActiveXObject("Microsoft.XMLHTTP");
  1023. }
  1024. http_request.onreadystatechange=function()
  1025. {
  1026. if (http_request.readyState==4)
  1027. {
  1028. if (http_request.status==200)
  1029. {
  1030. //获取URL并打开
  1031. str_json = http_request.responseText;
  1032. var obj_json = eval('(' + str_json + ')');
  1033. var str_vdl_url = obj_json["url"];
  1034. //alert(str_vdl_url);
  1035. window.open("http://" + str_vdl_url);
  1036. }
  1037. else
  1038. {
  1039. alert("打开失败,请检查服务器配置\n" + http_request.responseText);
  1040. }
  1041. }
  1042. }
  1043. http_request.open("GET", str_srv_url + "/project/task/vdl?tid=" + str_view_task_id, true);
  1044. http_request.send(null);
  1045. }
  1046. //关闭评估&导出模型弹出窗口
  1047. function hide_evaluate_export_win_modal(obj)
  1048. {
  1049. var obj_evaluate_export_task_project_id = document.getElementById('evaluate_export_task_project_id');
  1050. obj_evaluate_export_task_project_id.value = "";
  1051. var on_win_evaluate_export_model = document.getElementById('input_win_evaluate_export_model');
  1052. var over_win_evaluate_export_model = document.getElementById('input_win_evaluate_export_model_over');
  1053. on_win_evaluate_export_model.style.display = "none";
  1054. over_win_evaluate_export_model.style.display = "none";
  1055. }
  1056. //显示评估&导出模型弹出窗口
  1057. function show_evaluate_export_win_modal(obj)
  1058. {
  1059. var obj_detail_task_id = document.getElementById('task_detail_id');
  1060. var obj_export_task_id = document.getElementById('evaluate_export_task_id');
  1061. obj_export_task_id.value = obj_detail_task_id.value;
  1062. if(null == obj_export_task_id.value || 'undefined' == typeof(obj_export_task_id.value) || '' == obj_export_task_id.value)
  1063. {
  1064. obj_export_task_id.value = obj.id;
  1065. }
  1066. //初始化路径(workspace/projects/TXXX/export_model)
  1067. var http_request = new XMLHttpRequest();
  1068. http_request.open('GET', str_srv_url + "/workspace", false);
  1069. http_request.send(null);
  1070. var obj_json = eval('(' + http_request.responseText + ')');
  1071. var str_init_model_save_path = obj_json["dirname"];
  1072. var str_obj_task_prj_key = "view_task_pid_" + obj_export_task_id.value;
  1073. var obj_project_id = document.getElementById(str_obj_task_prj_key);
  1074. var str_project_id = obj_project_id.value;
  1075. var obj_evaluate_export_task_project_id = document.getElementById('evaluate_export_task_project_id');
  1076. obj_evaluate_export_task_project_id.value = str_project_id;
  1077. var obj_model_save_path = document.getElementById('export_model_path_text');
  1078. obj_model_save_path.value = str_init_model_save_path + "/projects/" + str_project_id + "/" + obj_export_task_id.value + "/export_model";
  1079. var on_win_evaluate_export_model = document.getElementById('input_win_evaluate_export_model');
  1080. var over_win_evaluate_export_model = document.getElementById('input_win_evaluate_export_model_over');
  1081. on_win_evaluate_export_model.style.display = "block";
  1082. over_win_evaluate_export_model.style.display = "block";
  1083. }
  1084. //评估任务
  1085. function evaluate_task(obj)
  1086. {
  1087. var obj_evaluate_task_id = document.getElementById('evaluate_export_task_id');
  1088. var str_evaluate_task_id = obj_evaluate_task_id.value;
  1089. //启动评估
  1090. var http_request;
  1091. if (window.XMLHttpRequest)
  1092. {
  1093. http_request=new XMLHttpRequest();
  1094. }
  1095. else
  1096. {
  1097. http_request=new ActiveXObject("Microsoft.XMLHTTP");
  1098. }
  1099. http_request.onreadystatechange=function()
  1100. {
  1101. if (http_request.readyState==4)
  1102. {
  1103. if (http_request.status==200)
  1104. {
  1105. //查看评估报告
  1106. http_request.open("GET", str_srv_url + "/project/task/evaluate?tid=" + str_evaluate_task_id, false);
  1107. http_request.send(null);
  1108. alert("评估完成,评估结果:\n" + http_request.responseText);
  1109. }
  1110. else
  1111. {
  1112. alert("评估失败,请检查服务器配置\n" + http_request.responseText);
  1113. }
  1114. }
  1115. }
  1116. var data = {"tid":str_evaluate_task_id,"epoch":null,"topk":5,'score_thresh':null, 'overlap_thresh':null};
  1117. http_request.open("POST", str_srv_url + "/project/task/evaluate", true);
  1118. http_request.setRequestHeader("Content-type","application/json");
  1119. http_request.send(JSON.stringify(data));
  1120. }
  1121. //导出任务模型
  1122. function export_model(obj)
  1123. {
  1124. //任务id
  1125. var obj_export_task_id = document.getElementById('evaluate_export_task_id');
  1126. var str_export_task_id = obj_export_task_id.value;
  1127. //导出路径
  1128. var str_model_save_path = "";
  1129. var obj_model_save_path = document.getElementById('export_model_path_text');
  1130. str_model_save_path = obj_model_save_path.value;
  1131. var http_request;
  1132. if (window.XMLHttpRequest)
  1133. {
  1134. http_request=new XMLHttpRequest();
  1135. }
  1136. else
  1137. {
  1138. http_request=new ActiveXObject("Microsoft.XMLHTTP");
  1139. }
  1140. http_request.onreadystatechange=function()
  1141. {
  1142. if (http_request.readyState==4)
  1143. {
  1144. if (http_request.status==200)
  1145. {
  1146. //获取URL并打开
  1147. alert("导出成功! 模型保存路径:" + str_model_save_path);
  1148. //追加到导出模型列表
  1149. var str_project_id = "";
  1150. var obj_task_project_id = document.getElementById('evaluate_export_task_project_id');
  1151. str_project_id = obj_task_project_id.value;
  1152. var model_data = {"pid":str_project_id,"tid":str_export_task_id,"name":str_export_task_id + "_export_model","type":"exported","source_path":"","path":str_model_save_path,"exported_type":0,"eval_results":{}};
  1153. var model_http_request = new XMLHttpRequest();
  1154. model_http_request.open("POST", str_srv_url + "/model", false);
  1155. model_http_request.setRequestHeader("Content-type","application/json");
  1156. model_http_request.send(JSON.stringify(model_data));
  1157. }
  1158. else
  1159. {
  1160. alert("导出失败,请检查服务器配置\n" + http_request.responseText);
  1161. }
  1162. }
  1163. }
  1164. var data = {"tid":str_export_task_id,"type":"infer","save_dir":str_model_save_path,'quant': false, 'epoch':5};
  1165. http_request.open("POST", str_srv_url + "/project/task/export", true);
  1166. http_request.setRequestHeader("Content-type","application/json");
  1167. http_request.send(JSON.stringify(data));
  1168. }
  1169. //联系方式
  1170. function contact_us()
  1171. {
  1172. alert("PaddleX QQ群:1045148026");
  1173. }
  1174. //刷新按纽
  1175. function refresh_contents(obj)
  1176. {
  1177. if(obj.value == "刷新项目信息")
  1178. load_projects(obj);
  1179. else if (obj.value == "刷新数据集信息")
  1180. load_datasets(obj);
  1181. else if (obj.value == "刷新所有任务信息")
  1182. load_tasks(obj);
  1183. else if (obj.value == "刷新项目任务信息")
  1184. {
  1185. load_project_tasks(g_view_project_task_id);
  1186. }
  1187. else if (obj.value == "刷新模型信息")
  1188. load_models(obj);
  1189. else
  1190. load_projects(obj);
  1191. }
  1192. //项目对象右键弹出菜单
  1193. function show_project_popupmenu(obj)
  1194. {
  1195. var obj_project_id = document.getElementById('popup_menu_project_id');
  1196. obj_project_id.value = obj.id;
  1197. var menu = document.getElementById('popupmenu_project');
  1198. menu.style.display = 'block';
  1199. menu.style.left = document.documentElement.scrollLeft + document.body.scrollLeft+ window.event.clientX + 'px';
  1200. menu.style.top = document.documentElement.scrollTop + document.body.scrollTop+ window.event.clientY + 'px';
  1201. window.event.returnValue=false;
  1202. window.event.cancelBubble=true;
  1203. window.event.preventDafault();
  1204. window.event.stopPropagation();
  1205. return false;
  1206. }
  1207. //数据集对象右键弹出菜单
  1208. function show_dataset_popupmenu(obj)
  1209. {
  1210. var obj_dataset_id = document.getElementById('popup_menu_dataset_id');
  1211. obj_dataset_id.value = obj.id;
  1212. var menu = document.getElementById('popupmenu_dataset');
  1213. menu.style.display = 'block';
  1214. menu.style.left = document.documentElement.scrollLeft + document.body.scrollLeft+ window.event.clientX + 'px';
  1215. menu.style.top = document.documentElement.scrollTop + document.body.scrollTop+ window.event.clientY + 'px';
  1216. window.event.returnValue=false;
  1217. window.event.cancelBubble=true;
  1218. window.event.preventDafault();
  1219. window.event.stopPropagation();
  1220. return false;
  1221. }
  1222. //任务对象右键弹出菜单
  1223. function show_task_popupmenu(obj)
  1224. {
  1225. var obj_task_id = document.getElementById('popup_menu_task_id');
  1226. obj_task_id.value = obj.id;
  1227. var menu = document.getElementById('popupmenu_task');
  1228. menu.style.display = 'block';
  1229. menu.style.left = document.documentElement.scrollLeft + document.body.scrollLeft+ window.event.clientX + 'px';
  1230. menu.style.top = document.documentElement.scrollTop + document.body.scrollTop+ window.event.clientY + 'px';
  1231. window.event.returnValue=false;
  1232. window.event.cancelBubble=true;
  1233. window.event.preventDafault();
  1234. window.event.stopPropagation();
  1235. return false;
  1236. }
  1237. //任务对象右键弹出菜单
  1238. function show_models_popupmenu(obj)
  1239. {
  1240. var obj_model_id = document.getElementById('popup_menu_model_id');
  1241. obj_model_id.value = obj.id;
  1242. var menu = document.getElementById('popupmenu_model');
  1243. menu.style.display = 'block';
  1244. menu.style.left = document.documentElement.scrollLeft + document.body.scrollLeft+ window.event.clientX + 'px';
  1245. menu.style.top = document.documentElement.scrollTop + document.body.scrollTop+ window.event.clientY + 'px';
  1246. window.event.returnValue=false;
  1247. window.event.cancelBubble=true;
  1248. window.event.preventDafault();
  1249. window.event.stopPropagation();
  1250. return false;
  1251. }
  1252. //隐藏右键菜单
  1253. document.onclick = function()
  1254. {
  1255. var menu = document.getElementById('popupmenu_project');
  1256. menu.style.display = 'none';
  1257. var obj_project_id = document.getElementById('popup_menu_project_id');
  1258. obj_project_id.value = "";
  1259. menu = document.getElementById('popupmenu_dataset');
  1260. menu.style.display = 'none';
  1261. var obj_dataset_id = document.getElementById('popup_menu_dataset_id');
  1262. obj_dataset_id.value = "";
  1263. menu = document.getElementById('popupmenu_task');
  1264. menu.style.display = 'none';
  1265. var obj_task_id = document.getElementById('popup_menu_task_id');
  1266. obj_task_id.value = "";
  1267. menu = document.getElementById('popupmenu_model');
  1268. menu.style.display = 'none';
  1269. var obj_model_id = document.getElementById('popup_menu_model_id');
  1270. obj_model_id.value = "";
  1271. }
  1272. //PaddleX RestfulAPI Demo Code
  1273. //设置远端服务器地址
  1274. function set_server_addr(input_data)
  1275. {
  1276. var input_srv_url = document.getElementById('server_url_text');
  1277. str_srv_url = input_srv_url.value;
  1278. var last_pos = str_srv_url.length - 1;
  1279. var last_char = str_srv_url.charAt(last_pos);
  1280. if(last_char == '/')
  1281. {
  1282. str_srv_url = str_srv_url.substring(0, (str_srv_url.length - 1));
  1283. }
  1284. var http_request = new XMLHttpRequest();
  1285. http_request.onreadystatechange=function()
  1286. {
  1287. if (http_request.readyState==4)
  1288. {
  1289. if (http_request.status==200)
  1290. {
  1291. str_json = http_request.responseText;
  1292. var obj_json = eval('(' + str_json + ')');
  1293. var str_workspace_dir = obj_json["dirname"];
  1294. alert("设置成功!\n服务器地址:" + str_srv_url + "\n服务器工作区路径:" + str_workspace_dir);
  1295. hide_server_info(null);
  1296. load_projects();
  1297. }
  1298. else
  1299. {
  1300. alert("设置失败,服务器连接失败,请检查服务器地址是否正确!" + http_request.responseText)
  1301. }
  1302. }
  1303. }
  1304. http_request.open('GET', str_srv_url + "/workspace", true);
  1305. http_request.send(null);
  1306. }
  1307. //获取工作区所有项目信息
  1308. function load_projects()
  1309. {
  1310. var http_request;
  1311. if (window.XMLHttpRequest)
  1312. {
  1313. http_request=new XMLHttpRequest();
  1314. }
  1315. else
  1316. {
  1317. http_request=new ActiveXObject("Microsoft.XMLHTTP");
  1318. }
  1319. http_request.onreadystatechange=function()
  1320. {
  1321. if(http_request.readyState==4 && http_request.status==200)
  1322. {
  1323. //更新表格内容
  1324. fill_table_contents(http_request.responseText, "project");
  1325. }
  1326. else
  1327. {
  1328. fill_table_with_error();
  1329. }
  1330. }
  1331. http_request.open("GET",str_srv_url + "/project",true);
  1332. http_request.send(null);
  1333. }
  1334. //创建项目
  1335. function create_project(input_data)
  1336. {
  1337. var input_prj_name = document.getElementById('project_name_text');
  1338. var input_prj_type = document.getElementById('project_type_text');
  1339. var input_prj_desc = document.getElementById('project_desc_text');
  1340. var input_prj_dataset = document.getElementById('create_project_dataset_id_text');
  1341. var str_prj_name = input_prj_name.value;
  1342. var str_prj_type = input_prj_type.value;
  1343. var str_prj_desc = input_prj_desc.value;
  1344. var str_prj_dataset_id = input_prj_dataset.value;
  1345. if(str_prj_name == "")
  1346. {
  1347. alert("请输入项目名称");
  1348. return;
  1349. }
  1350. if(str_prj_dataset_id == 0)
  1351. {
  1352. alert("请选择项目对应数据集或者创建数据集");
  1353. return;
  1354. }
  1355. var http_request = new XMLHttpRequest();
  1356. http_request.onreadystatechange=function()
  1357. {
  1358. if (http_request.readyState==4)
  1359. {
  1360. if (http_request.status==200)
  1361. {
  1362. str_json = http_request.responseText;
  1363. alert("项目创建成功!\n" + str_json);
  1364. var obj_json = eval('(' + str_json + ')');
  1365. var str_new_pid = obj_json["pid"];
  1366. //绑定数据集
  1367. var attr_dict = {'did': str_prj_dataset_id};
  1368. var bind_params = {'struct': 'project', 'id': str_new_pid, 'attr_dict': attr_dict}
  1369. var bind_http_request = new XMLHttpRequest();
  1370. bind_http_request.open("PUT", str_srv_url + "/workspace", false);
  1371. bind_http_request.setRequestHeader("Content-type","application/json");
  1372. bind_http_request.send(JSON.stringify(bind_params));
  1373. hide_create_prj_win_modal();
  1374. load_projects();
  1375. }
  1376. else
  1377. {
  1378. alert("项目创建失败,请检查服务器配置" + http_request.responseText);
  1379. }
  1380. }
  1381. }
  1382. var data = {"name":str_prj_name,"desc":str_prj_desc,"project_type":str_prj_type};
  1383. http_request.open("POST", str_srv_url + "/project", true);
  1384. http_request.setRequestHeader("Content-type","application/json");
  1385. http_request.send(JSON.stringify(data));
  1386. }
  1387. //查看一个项目
  1388. function show_project(data)
  1389. {
  1390. g_view_project_task_id = data.id;
  1391. g_view_project_task_type = document.getElementById("view_project_type_" + g_view_project_task_id).value;
  1392. //查看项目下的任务
  1393. load_project_tasks(data.id);
  1394. }
  1395. //获取工作区所有数据集信息
  1396. function load_datasets()
  1397. {
  1398. var http_request;
  1399. if (window.XMLHttpRequest)
  1400. {
  1401. http_request=new XMLHttpRequest();
  1402. }
  1403. else
  1404. {
  1405. http_request=new ActiveXObject("Microsoft.XMLHTTP");
  1406. }
  1407. http_request.onreadystatechange=function()
  1408. {
  1409. if(http_request.readyState==4 && http_request.status==200)
  1410. {
  1411. //更新表格内容
  1412. fill_table_contents(http_request.responseText, "dataset");
  1413. }
  1414. else
  1415. {
  1416. fill_table_with_error();
  1417. }
  1418. }
  1419. http_request.open("GET",str_srv_url + "/dataset",false);
  1420. http_request.send(null);
  1421. }
  1422. //获取所有任务信息
  1423. function load_tasks()
  1424. {
  1425. document.getElementById("btn_refresh").value = "刷新所有任务信息";
  1426. var http_request;
  1427. if (window.XMLHttpRequest)
  1428. {
  1429. http_request=new XMLHttpRequest();
  1430. }
  1431. else
  1432. {
  1433. http_request=new ActiveXObject("Microsoft.XMLHTTP");
  1434. }
  1435. http_request.onreadystatechange=function()
  1436. {
  1437. if(http_request.readyState==4 && http_request.status==200)
  1438. {
  1439. //更新表格内容
  1440. fill_table_contents(http_request.responseText, "task");
  1441. }
  1442. else
  1443. {
  1444. fill_table_with_error();
  1445. }
  1446. }
  1447. http_request.open("GET",str_srv_url + "/project/task",false);
  1448. http_request.send(null);
  1449. }
  1450. //获取项目下的任务
  1451. function load_project_tasks(str_project_id)
  1452. {
  1453. document.getElementById("btn_refresh").value = "刷新项目任务信息";
  1454. var http_request;
  1455. if (window.XMLHttpRequest)
  1456. {
  1457. http_request=new XMLHttpRequest();
  1458. }
  1459. else
  1460. {
  1461. http_request=new ActiveXObject("Microsoft.XMLHTTP");
  1462. }
  1463. http_request.onreadystatechange=function()
  1464. {
  1465. if(http_request.readyState==4 && http_request.status==200)
  1466. {
  1467. //更新表格内容
  1468. fill_table_contents(http_request.responseText, "task");
  1469. }
  1470. else
  1471. {
  1472. fill_table_with_error();
  1473. }
  1474. }
  1475. http_request.open("GET",str_srv_url + "/project/task?pid=" + str_project_id,false);
  1476. http_request.send(null);
  1477. }
  1478. //创建数据集
  1479. function create_dataset(input_data)
  1480. {
  1481. var http_request = new XMLHttpRequest();
  1482. http_request.onreadystatechange=function()
  1483. {
  1484. if (http_request.readyState==4)
  1485. {
  1486. if (http_request.status==200)
  1487. {
  1488. alert("数据集创建成功!\n" + http_request.responseText);
  1489. hide_create_dataset_win_modal();
  1490. load_datasets();
  1491. }
  1492. else
  1493. {
  1494. alert("数据集创建失败,请检查服务器配置" + http_request.responseText);
  1495. }
  1496. }
  1497. }
  1498. var input_dataset_name = document.getElementById('dataset_name_text');
  1499. var input_dataset_type = document.getElementById('dataset_type_text');
  1500. var input_dataset_desc = document.getElementById('dataset_desc_text');
  1501. var str_dataset_name = input_dataset_name.value;
  1502. var str_dataset_type = input_dataset_type.value;
  1503. var str_dataset_desc = input_dataset_desc.value;
  1504. if(str_dataset_name == "")
  1505. {
  1506. alert("请输入数据集名称");
  1507. return;
  1508. }
  1509. var data = {"name":str_dataset_name,"desc":str_dataset_desc,"dataset_type":str_dataset_type};
  1510. http_request.open("POST", str_srv_url + "/dataset", true);
  1511. http_request.setRequestHeader("Content-type","application/json");
  1512. http_request.send(JSON.stringify(data));
  1513. }
  1514. //导入数据集
  1515. function import_dataset(obj)
  1516. {
  1517. var http_request = new XMLHttpRequest();
  1518. http_request.onreadystatechange=function()
  1519. {
  1520. if (http_request.readyState==4)
  1521. {
  1522. if (http_request.status==200)
  1523. {
  1524. alert("数据集导入成功!\n" + http_request.responseText);
  1525. hide_import_dataset_win_modal(obj);
  1526. load_datasets();
  1527. }
  1528. else
  1529. {
  1530. alert("数据集导入失败,请检查服务器配置" + http_request.responseText);
  1531. }
  1532. }
  1533. }
  1534. var obj_import_dataset_id = document.getElementById('import_dataset_id');
  1535. str_import_dataset_id = obj_import_dataset_id.value;
  1536. var input_dataset_path = document.getElementById('import_dataset_path_text');
  1537. var str_dataset_path = input_dataset_path.value;
  1538. if(str_dataset_path == "")
  1539. {
  1540. alert("请输入数据集路径");
  1541. return;
  1542. }
  1543. var data = {"did":str_import_dataset_id,"path":str_dataset_path};
  1544. http_request.open("PUT", str_srv_url + "/dataset", true);
  1545. http_request.setRequestHeader("Content-type","application/json");
  1546. http_request.send(JSON.stringify(data));
  1547. }
  1548. //切分数据集
  1549. function split_dataset(obj)
  1550. {
  1551. var http_request = new XMLHttpRequest();
  1552. http_request.onreadystatechange=function()
  1553. {
  1554. if (http_request.readyState==4)
  1555. {
  1556. if (http_request.status==200)
  1557. {
  1558. alert("数据集切分成功!\n" + http_request.responseText);
  1559. hide_split_dataset_win_modal(obj);
  1560. load_datasets();
  1561. }
  1562. else
  1563. {
  1564. alert("数据集切分失败,请检查服务器配置" + http_request.responseText);
  1565. }
  1566. }
  1567. }
  1568. var obj_split_dataset_id = document.getElementById('split_dataset_id');
  1569. var str_split_dataset_id = obj_split_dataset_id.value;
  1570. var obj_split_dataset_var_percent = document.getElementById('split_dataset_val_percent');
  1571. var val_split = obj_split_dataset_var_percent.value/100;
  1572. var obj_split_dataset_test_percent = document.getElementById('split_dataset_test_percent');
  1573. var test_split = obj_split_dataset_test_percent.value/100;
  1574. var data = {"did":str_split_dataset_id, "val_split":val_split, "test_split":test_split};
  1575. alert(JSON.stringify(data));
  1576. http_request.open("PUT", str_srv_url + "/dataset/split", true);
  1577. http_request.setRequestHeader("Content-type","application/json");
  1578. http_request.send(JSON.stringify(data));
  1579. }
  1580. //获取所有导出模型
  1581. function load_models()
  1582. {
  1583. var http_request;
  1584. if (window.XMLHttpRequest)
  1585. {
  1586. http_request=new XMLHttpRequest();
  1587. }
  1588. else
  1589. {
  1590. http_request=new ActiveXObject("Microsoft.XMLHTTP");
  1591. }
  1592. http_request.onreadystatechange=function()
  1593. {
  1594. if(http_request.readyState==4 && http_request.status==200)
  1595. {
  1596. //更新表格内容
  1597. fill_table_contents(http_request.responseText, "models");
  1598. }
  1599. else
  1600. {
  1601. fill_table_with_error();
  1602. }
  1603. }
  1604. http_request.open("GET",str_srv_url + "/model?type=exported",false);
  1605. http_request.send(null);
  1606. }
  1607. //填充对象信息到表格(项目/数据集/任务/模型)
  1608. function fill_table_contents(list_contents, type = "project")
  1609. {
  1610. if(type == "project")
  1611. {
  1612. document.getElementById("btn_refresh").value = "刷新项目信息";
  1613. rows = table_contents.rows.length;
  1614. for (i=0;i<rows;i++)
  1615. {
  1616. table_contents.deleteRow(i);
  1617. rows=rows-1;
  1618. i=i-1;
  1619. }
  1620. rows = table_contents.rows.length;
  1621. var newTr=table_contents.insertRow(rows);
  1622. var str_json = eval('(' + list_contents + ')');
  1623. var obj_prjs = str_json["projects"];
  1624. count_prj = Object.keys(obj_prjs).length;
  1625. col_count = 1;
  1626. //项目为空
  1627. if(count_prj <= 0)
  1628. {
  1629. var newTd0=newTr.insertCell();
  1630. var str_html = "<div id=\"draw-border\"><view_item id=\"btn_create\" onclick=\"show_create_project_win_modal(this)\" style=\"width: 240px; height: 90px; align: center\">"
  1631. str_html = str_html + "<br><font color=\"blue\">暂无项目,点击创建新项目</font>";
  1632. str_html = str_html + "</view_item></div>";
  1633. newTd0.innerHTML = str_html;
  1634. return;
  1635. }
  1636. for(var p in obj_prjs)
  1637. {
  1638. str_id = obj_prjs[p].id;
  1639. str_attr = obj_prjs[p].attr;
  1640. str_name = str_attr["name"];
  1641. str_desc = str_attr["desc"];
  1642. str_type = str_attr["type"];
  1643. str_crttime = str_attr["create_time"];
  1644. var newTd0=newTr.insertCell();
  1645. var str_html = "";
  1646. str_html = "<div id=\"draw-border\" style=\"word-wrap: break-word;\"><view_item onclick=\"show_project(this)\" oncontextmenu=\"javascript:show_project_popupmenu(this);\" id=\"" + str_id + "\">";
  1647. str_html = str_html + "项目名称:" + str_name + " (" + str_id + ")" + "<br>";
  1648. if(str_type == "classification")
  1649. str_type_view = "<font color=\"green\">图像分类</font>";
  1650. else if(str_type == "detection")
  1651. str_type_view = "<font color=\"purple\">目标检测</font>";
  1652. else if(str_type == "instance_segmentation")
  1653. str_type_view = "<font color=\"orange\">实例分割</font>";
  1654. else if(str_type == "segmentation")
  1655. str_type_view = "<font color=\"red\">语义分割</font>";
  1656. //如下所示,后续如果要获取对象数据,可以在此处放hidden input,后续再通过id获取
  1657. str_html = str_html + "项目类型:" + str_type_view + "<br>" + "<input type=\"hidden\" id=\"view_project_type_" + str_id + "\" value=\"" + str_type + "\">";
  1658. str_html = str_html + "项目描述:" + str_desc + "<br><br><br>";
  1659. str_html = str_html + "创建时间:" + str_crttime + "<br>";
  1660. str_html = str_html + "</view_item></div>";
  1661. newTd0.innerHTML = str_html;
  1662. if(col_count == 5)
  1663. {
  1664. rows = table_contents.rows.length;
  1665. newTr=table_contents.insertRow(rows);
  1666. col_count = 1;
  1667. }
  1668. else
  1669. {
  1670. col_count = col_count + 1;
  1671. }
  1672. }
  1673. }
  1674. else if(type == "dataset")
  1675. {
  1676. document.getElementById("btn_refresh").value = "刷新数据集信息";
  1677. rows = table_contents.rows.length;
  1678. for (i=0;i<rows;i++)
  1679. {
  1680. table_contents.deleteRow(i);
  1681. rows=rows-1;
  1682. i=i-1;
  1683. }
  1684. rows = table_contents.rows.length;
  1685. var newTr=table_contents.insertRow(rows);
  1686. var str_json = eval('(' + list_contents + ')');
  1687. var obj_datasets = str_json["datasets"];
  1688. count_datasets = Object.keys(obj_datasets).length;
  1689. col_count = 1;
  1690. //数据集为空
  1691. if(count_datasets <= 0)
  1692. {
  1693. var newTd0=newTr.insertCell();
  1694. var str_html = "<div id=\"draw-border\"><view_item id=\"btn_create\" onclick=\"show_create_dataset_win_modal(this)\" style=\"width: 260px; height: 90px; align: center\">"
  1695. str_html = str_html + "<br><font color=\"blue\">暂无数据集,点击创建数据集</font>";
  1696. str_html = str_html + "</view_item></div>";
  1697. newTd0.innerHTML = str_html;
  1698. return;
  1699. }
  1700. for(var p in obj_datasets)
  1701. {
  1702. str_id = obj_datasets[p].id;
  1703. str_attr = obj_datasets[p].attr;
  1704. str_name = str_attr["name"];
  1705. str_desc = str_attr["desc"];
  1706. str_type = str_attr["type"];
  1707. str_crttime = str_attr["create_time"];
  1708. str_status = str_attr["dataset_status"];
  1709. str_dataset_path = str_attr["path"];
  1710. //增加状态显示以及对应的操作
  1711. var view_status_str = "未导入";
  1712. var str_function = "void";
  1713. if (str_status == DatasetStatus.XEMPTY)
  1714. {
  1715. view_status_str = "未导入";
  1716. str_function = "show_import_dataset_win_modal";
  1717. }
  1718. else if (str_status == DatasetStatus.XCHECKING)
  1719. {
  1720. view_status_str = "校验中";
  1721. }
  1722. else if (str_status == DatasetStatus.XCHECKFAIL)
  1723. {
  1724. view_status_str = "校验失败";
  1725. str_function = "show_import_dataset_win_modal";
  1726. }
  1727. else if (str_status == DatasetStatus.XCOPYING)
  1728. {
  1729. view_status_str = "导入中";
  1730. }
  1731. else if (str_status == DatasetStatus.XCOPYDONE)
  1732. {
  1733. view_status_str = "已校验&未切分";
  1734. str_function = "show_split_dataset_win_modal";
  1735. }
  1736. else if (str_status == DatasetStatus.XSPLITED)
  1737. {
  1738. view_status_str = "已校验&已切分";
  1739. str_function = "show_browse_dataset_win_modal";
  1740. }
  1741. else if (str_status == DatasetStatus.XCOPYFAIL)
  1742. {
  1743. view_status_str = "导入失败";
  1744. str_function = "show_import_dataset_win_modal";
  1745. }
  1746. var newTd0=newTr.insertCell();
  1747. var str_html = "";
  1748. str_html = "<div id=\"draw-border\" style=\"word-wrap: break-word;\"><view_item id=\"" + str_id + "\" onclick=\"javascript:" + str_function + "(this);\" oncontextmenu=\"javascript:show_dataset_popupmenu(this);\">";
  1749. str_html = str_html + "数据集名称:" + str_name + " (" + str_id + ")" + "<br>" + "<input type=\"hidden\" id=\"view_dataset_name_" + str_id + "\" value=\"" + str_name + "\">";
  1750. if(str_type == "classification")
  1751. {
  1752. str_dataset_type = "图像分类";
  1753. str_type_view = "<font color=\"green\">图像分类</font>";
  1754. }
  1755. else if(str_type == "detection")
  1756. {
  1757. str_dataset_type = "目标检测";
  1758. str_type_view = "<font color=\"purple\">目标检测</font>";
  1759. }
  1760. else if(str_type == "instance_segmentation")
  1761. {
  1762. str_dataset_type = "实例分割";
  1763. str_type_view = "<font color=\"orange\">实例分割</font>";
  1764. }
  1765. else if(str_type == "segmentation")
  1766. {
  1767. str_dataset_type = "语义分割";
  1768. str_type_view = "<font color=\"red\">语义分割</font>";
  1769. }
  1770. //如果需要获取对象信息,可以在此增加hidden的input
  1771. str_html = str_html + "数据集类型:" + str_type_view + "<br>" + "<input type=\"hidden\" id=\"view_dataset_type_" + str_id + "\" value=\"" + str_dataset_type + "\">";
  1772. str_html = str_html + "数据集描述:" + str_desc + "<br><br>" + "<input type=\"hidden\" id=\"view_dataset_desc_" + str_id + "\" value=\"" + str_desc + "\">";
  1773. str_html = str_html + "创建时间:" + str_crttime + "<br>" + "<input type=\"hidden\" id=\"view_dataset_path_" + str_id + "\" value=\"" + str_dataset_path + "\">";
  1774. str_html = str_html + "数据集状态:" + view_status_str + "<br>";
  1775. str_html = str_html + "</view_item></div>";
  1776. newTd0.innerHTML = str_html;
  1777. if(col_count == 5)
  1778. {
  1779. rows = table_contents.rows.length;
  1780. newTr=table_contents.insertRow(rows);
  1781. col_count = 1;
  1782. }
  1783. else
  1784. {
  1785. col_count = col_count + 1;
  1786. }
  1787. }
  1788. }
  1789. else if(type == "task")
  1790. {
  1791. rows = table_contents.rows.length;
  1792. for (i=0;i<rows;i++)
  1793. {
  1794. table_contents.deleteRow(i);
  1795. rows=rows-1;
  1796. i=i-1;
  1797. }
  1798. rows = table_contents.rows.length;
  1799. var newTr=table_contents.insertRow(rows);
  1800. var str_json = eval('(' + list_contents + ')');
  1801. var obj_tasks = str_json["tasks"];
  1802. count_tasks = Object.keys(obj_tasks).length;
  1803. col_count = 1;
  1804. //数据集为空
  1805. if(count_tasks <= 0)
  1806. {
  1807. var newTd0=newTr.insertCell();
  1808. var str_html = "";
  1809. if(document.getElementById("btn_refresh").value == "刷新项目任务信息")
  1810. {
  1811. str_html = "<div id=\"draw-border\"><view_item id=\"btn_create\" onclick=\"javascript:show_create_task_win_modal(this)\" style=\"width: 340px; height: 90px; align: center\">"
  1812. str_html = str_html + "<br><font color=\"blue\">当前项目无训练任务,点击创建训练任务</font>";
  1813. str_html = str_html + "</view_item></div>";
  1814. }
  1815. else
  1816. {
  1817. str_html = "<div id=\"draw-border\"><view_item id=\"btn_create\" onclick=\"javascript:void(this)\" style=\"width: 420px; height: 90px; align: center\">"
  1818. str_html = str_html + "<br><font color=\"blue\">当前无训练任务,请先在对应项目中创建训练任务</font>";
  1819. str_html = str_html + "</view_item></div>";
  1820. }
  1821. newTd0.innerHTML = str_html;
  1822. return;
  1823. }
  1824. for(var p in obj_tasks)
  1825. {
  1826. str_id = obj_tasks[p].id;
  1827. str_pid = obj_tasks[p].pid;
  1828. str_name = obj_tasks[p].name;
  1829. str_desc = obj_tasks[p].desc;
  1830. str_path = obj_tasks[p].path;
  1831. str_crttime = obj_tasks[p].create_time;
  1832. str_status = obj_tasks[p].status;
  1833. //增加状态显示以及对应的操作
  1834. var view_status_str = "初始化";
  1835. var str_function = "void";
  1836. if (str_status == TaskStatus.XUNINIT)
  1837. {
  1838. view_status_str = "初始化";
  1839. str_function = "show_init_task_win_modal";
  1840. }
  1841. else if (str_status == TaskStatus.XINIT)
  1842. {
  1843. view_status_str = "初始化";
  1844. str_function = "show_init_task_win_modal";
  1845. }
  1846. else if (str_status == TaskStatus.XDOWNLOADING)
  1847. {
  1848. view_status_str = "下载预训练模型中";
  1849. str_function = "show_task_detail_info_win_modal";
  1850. }
  1851. else if (str_status == TaskStatus.XTRAINING)
  1852. {
  1853. view_status_str = "训练中";
  1854. str_function = "show_task_detail_info_win_modal";
  1855. }
  1856. else if (str_status == TaskStatus.XTRAINDONE)
  1857. {
  1858. view_status_str = "训练完成";
  1859. str_function = "show_task_detail_info_win_modal";
  1860. }
  1861. else if (str_status == TaskStatus.XEVALUATED)
  1862. {
  1863. view_status_str = "评估完成";
  1864. str_function = "show_evaluate_export_win_modal";
  1865. }
  1866. else if (str_status == TaskStatus.XEXPORTING)
  1867. {
  1868. view_status_str = "模型导出中";
  1869. str_function = "show_task_detail_info_win_modal";
  1870. }
  1871. else if (str_status == TaskStatus.XEXPORTED)
  1872. {
  1873. view_status_str = "模型导出成功";
  1874. str_function = "show_task_detail_info_win_modal";
  1875. }
  1876. else if (str_status == TaskStatus.XTRAINEXIT)
  1877. {
  1878. view_status_str = "任务中止";
  1879. str_function = "show_task_detail_info_win_modal";
  1880. }
  1881. else if (str_status == TaskStatus.XDOWNLOADFAIL)
  1882. {
  1883. view_status_str = "预训练模型下载失败";
  1884. str_function = "show_task_detail_info_win_modal";
  1885. }
  1886. else if (str_status == TaskStatus.XTRAINFAIL)
  1887. {
  1888. view_status_str = "任务运行失败";
  1889. str_function = "show_task_detail_info_win_modal";
  1890. }
  1891. else if (str_status == TaskStatus.XEVALUATING)
  1892. {
  1893. view_status_str = "任务评估中";
  1894. str_function = "show_evaluate_export_win_modal";
  1895. }
  1896. else if (str_status == TaskStatus.XEVALUATEFAIL)
  1897. {
  1898. view_status_str = "评估失败";
  1899. str_function = "show_evaluate_export_win_modal";
  1900. }
  1901. else if (str_status == TaskStatus.XEXPORTFAIL)
  1902. {
  1903. view_status_str = "模型导出失败";
  1904. str_function = "show_evaluate_export_win_modal";
  1905. }
  1906. else if (str_status == TaskStatus.XPRUNEING)
  1907. {
  1908. view_status_str = "裁剪分析中";
  1909. //str_function = "show_task_detail_info_win_modal";
  1910. }
  1911. else if (str_status == TaskStatus.XPRUNETRAIN)
  1912. {
  1913. view_status_str = "裁剪训练中";
  1914. //str_function = "show_task_detail_info_win_modal";
  1915. }
  1916. var newTd0=newTr.insertCell();
  1917. var str_html = "";
  1918. var str_type = "classification";
  1919. str_html = "<div id=\"draw-border\" style=\"word-wrap: break-word;\"><view_item id=\"" + str_id + "\" onclick=\"javascript:" + str_function + "(this);\" oncontextmenu=\"javascript:show_task_popupmenu(this);\">";
  1920. str_html = str_html + "任务ID:" + str_id + "<br>";
  1921. if(str_type == "classification")
  1922. str_type_view = "<font color=\"green\">图像分类</font>";
  1923. else if(str_type == "detection")
  1924. str_type_view = "<font color=\"purple\">目标检测</font>";
  1925. else if(str_type == "instance_segmentation")
  1926. str_type_view = "<font color=\"orange\">实例分割</font>";
  1927. else if(str_type == "segmentation")
  1928. str_type_view = "<font color=\"red\">语义分割</font>";
  1929. //如果需要获取对象信息,可以在此增加hidden的input
  1930. str_html = str_html + "任务类型:" + str_type_view + "<br>" + "<input type=\"hidden\" id=\"view_task_prj_type_" + str_id + "\" value=\"" + str_type + "\">"
  1931. str_html = str_html + "所属项目:" + str_pid + "<br><br>" + "<input type=\"hidden\" id=\"view_task_pid_" + str_id + "\" value=\"" + str_pid + "\">";
  1932. str_html = str_html + "创建时间:" + str_crttime + "<br>";
  1933. str_html = str_html + "任务状态:" + view_status_str + "(" + str_status + ")" + "<br>";
  1934. str_html = str_html + "</view_item></div>";
  1935. newTd0.innerHTML = str_html;
  1936. if(col_count == 5)
  1937. {
  1938. rows = table_contents.rows.length;
  1939. newTr=table_contents.insertRow(rows);
  1940. col_count = 1;
  1941. }
  1942. else
  1943. {
  1944. col_count = col_count + 1;
  1945. }
  1946. }
  1947. }
  1948. else if(type == "models")
  1949. {
  1950. document.getElementById("btn_refresh").value = "刷新模型信息";
  1951. rows = table_contents.rows.length;
  1952. for (i=0;i<rows;i++)
  1953. {
  1954. table_contents.deleteRow(i);
  1955. rows=rows-1;
  1956. i=i-1;
  1957. }
  1958. rows = table_contents.rows.length;
  1959. var newTr=table_contents.insertRow(rows);
  1960. var str_json = eval('(' + list_contents + ')');
  1961. var obj_models = str_json["exported_models"];
  1962. count_models = Object.keys(obj_models).length;
  1963. col_count = 1;
  1964. //数据集为空
  1965. if(count_models <= 0)
  1966. {
  1967. var newTd0=newTr.insertCell();
  1968. var str_html = "<div id=\"draw-border\"><view_item id=\"btn_create\" onclick=\"javascript:void(this)\" style=\"width: 350px; height: 90px; align: center\">"
  1969. str_html = str_html + "<br><font color=\"blue\">暂无模型,请先启动任务训练并导出模型</font>";
  1970. str_html = str_html + "</view_item></div>";
  1971. newTd0.innerHTML = str_html;
  1972. return;
  1973. }
  1974. for(var p in obj_models)
  1975. {
  1976. str_id = obj_models[p].id;
  1977. var str_model_name = obj_models[p].name;
  1978. var str_model_view_type = "图像分类";
  1979. var str_model_path = obj_models[p].path;
  1980. var str_model = obj_models[p].model;
  1981. var str_model_crttime = obj_models[p].create_time;
  1982. var str_model_type = obj_models[p].type;
  1983. var str_model_pid = obj_models[p].pid;
  1984. var str_model_tid = obj_models[p].tid;
  1985. var newTd0=newTr.insertCell();
  1986. var str_html = "";
  1987. if(str_model_type == "classification")
  1988. str_model_view_type = "<font color=\"green\">图像分类</font>";
  1989. else if(str_model_type == "detection")
  1990. str_model_view_type = "<font color=\"purple\">目标检测</font>";
  1991. else if(str_model_type == "instance_segmentation")
  1992. str_model_view_type = "<font color=\"orange\">实例分割</font>";
  1993. else if(str_model_type == "segmentation")
  1994. str_model_view_type = "<font color=\"red\">语义分割</font>";
  1995. var str_function = "view_model_detail_info";
  1996. str_html = "<div id=\"draw-border\" style=\"word-wrap: break-word;\"><view_item id=\"" + str_id + "\" style=\"width: 750px;height: 170px;\" onclick=\"javascript:" + str_function + "(this);\" oncontextmenu=\"javascript:show_models_popupmenu(this);\">";
  1997. str_html = str_html + "模型名称:" + str_model_name + " (" + str_id + ")" + "<br>";
  1998. str_html = str_html + "模型类型:" + str_model_view_type + "<br>";
  1999. str_html = str_html + "网络结构:" + str_model + "<br>";
  2000. str_html = str_html + "所属项目及任务:" + str_model_pid + "-" + str_model_tid + "<br>";
  2001. //如果需要获取对象信息,可以在此增加hidden的input
  2002. str_html = str_html + "模型路径: <font size=\"1\">" + str_model_path + "</font><br>";
  2003. str_html = str_html + "导出时间:" + str_model_crttime + "<br>";
  2004. str_html = str_html + "</view_item></div>";
  2005. newTd0.innerHTML = str_html;
  2006. if(col_count == 2)
  2007. {
  2008. rows = table_contents.rows.length;
  2009. newTr=table_contents.insertRow(rows);
  2010. col_count = 1;
  2011. }
  2012. else
  2013. {
  2014. col_count = col_count + 1;
  2015. }
  2016. }
  2017. }
  2018. }
  2019. //错误信息提示
  2020. function fill_table_with_error()
  2021. {
  2022. rows = table_contents.rows.length;
  2023. for (i=0;i<rows;i++)
  2024. {
  2025. table_contents.deleteRow(i);
  2026. rows=rows-1;
  2027. i=i-1;
  2028. }
  2029. rows = table_contents.rows.length;
  2030. var newTr=table_contents.insertRow(rows);
  2031. var newTd0=newTr.insertCell();
  2032. var str_html = "<div id=\"draw-border\"><view_item id=\"btn_create\" onclick=\"show_server_info(this)\" style=\"width: 330px; height: 90px; align: center\">"
  2033. str_html = str_html + "<br><font color=\"red\">连接服务器失败,点击设置服务器信息</font>";
  2034. str_html = str_html + "</view_item></div>";
  2035. newTd0.innerHTML = str_html;
  2036. }
  2037. //显示创建任务弹出窗口
  2038. function show_create_task_win_modal(obj)
  2039. {
  2040. var obj_project_id = document.getElementById('popup_menu_project_id');
  2041. var str_project_id = "";
  2042. if(obj_project_id.value != "")
  2043. {
  2044. var input_create_task_prj_id = document.getElementById('create_task_project_id');
  2045. input_create_task_prj_id.value = obj_project_id.value;
  2046. str_project_id = obj_project_id.value;
  2047. }
  2048. else
  2049. {
  2050. var input_create_task_prj_id = document.getElementById('create_task_project_id');
  2051. input_create_task_prj_id.value = g_view_project_task_id;
  2052. str_project_id = g_view_project_task_id;
  2053. }
  2054. //创建任务时项目类型
  2055. var str_task_type = "";
  2056. try
  2057. {
  2058. str_task_type = document.getElementById("view_project_type_" + str_project_id).value;
  2059. }
  2060. catch(err)
  2061. {
  2062. str_task_type = g_view_project_task_type;
  2063. }
  2064. //取出默认参数
  2065. var http_request = new XMLHttpRequest();
  2066. http_request.open("GET", str_srv_url + "/project/task/params?pid=" + str_project_id, false);
  2067. http_request.send(null);
  2068. //填充参数到表格
  2069. add_parms_to_table(http_request.responseText, str_task_type);
  2070. //按纽
  2071. var obj_btn = document.getElementById('btn_create_task');
  2072. obj_btn.value = "创建并启动训练";
  2073. var on_win_create_task = document.getElementById('input_win_create_task');
  2074. var over_win_create_task = document.getElementById('input_win_create_task_over');
  2075. on_win_create_task.style.display = "block";
  2076. over_win_create_task.style.display = "block";
  2077. }
  2078. //隐藏创建任务弹出窗口
  2079. function hide_create_task_win_modal(obj)
  2080. {
  2081. var on_win_create_task = document.getElementById('input_win_create_task');
  2082. var over_win_create_task = document.getElementById('input_win_create_task_over');
  2083. var input_create_task_prj_id = document.getElementById('create_task_project_id');
  2084. on_win_create_task.style.display = "none";
  2085. over_win_create_task.style.display = "none";
  2086. input_create_task_prj_id.value = "";
  2087. }
  2088. //显示任务初始化参数及启动训练弹窗
  2089. function show_init_task_win_modal(obj)
  2090. {
  2091. var str_view_task_id = obj.id;
  2092. var str_obj_task_prj_key = "view_task_pid_" + obj.id;
  2093. var obj_project_id = document.getElementById(str_obj_task_prj_key);
  2094. var str_project_id = obj_project_id.value;
  2095. //任务类型
  2096. var str_task_type = document.getElementById("view_task_prj_type_" + str_view_task_id).value;
  2097. //取出默认参数
  2098. var http_request = new XMLHttpRequest();
  2099. http_request.open("GET", str_srv_url + "/project/task/params?tid=" + str_view_task_id, false);
  2100. http_request.send(null);
  2101. //填充参数到表格
  2102. add_parms_to_table(http_request.responseText, str_task_type);
  2103. //tid赋值成obj.id
  2104. var obj_init_task_input = document.getElementById('create_task_hidden_task_id');
  2105. obj_init_task_input.value = obj.id;
  2106. var obj_btn = document.getElementById('btn_create_task');
  2107. obj_btn.value = "启动训练";
  2108. var on_win_create_task = document.getElementById('input_win_create_task');
  2109. var over_win_create_task = document.getElementById('input_win_create_task_over');
  2110. on_win_create_task.style.display = "block";
  2111. over_win_create_task.style.display = "block";
  2112. }
  2113. //增加所有参数到表格
  2114. function add_parms_to_table(str_parms, str_type = "classification")
  2115. {
  2116. var obj_json = eval('(' + str_parms + ')');
  2117. var obj_parms = obj_json["train"];
  2118. g_train_task_parms = obj_parms;
  2119. var rows = table_create_task.rows.length;
  2120. for (i=0;i<rows;i++)
  2121. {
  2122. table_create_task.deleteRow(i);
  2123. rows=rows-1;
  2124. i=i-1;
  2125. }
  2126. //根据模型类型增加参数
  2127. var tr_bg_color_gen = "#D4FB79";
  2128. var tr_bg_color_adv = "#FFFC79";
  2129. var tr_bg_color_aug = "#76D6FF";
  2130. var rows = table_create_task.rows.length;
  2131. var newTr = table_create_task.insertRow(rows);
  2132. newTr.className = "parent_parm_row";
  2133. newTr.id = "general_parm_row";
  2134. newTr.onclick=function()
  2135. {
  2136. for (i=0; i < table_create_task.rows.length; i++)
  2137. {
  2138. var obj_tr = table_create_task.rows[i];
  2139. if(obj_tr.className == "child_" + this.id)
  2140. {
  2141. if(obj_tr.style.display == "none")
  2142. obj_tr.style.display = "table-row";
  2143. else
  2144. obj_tr.style.display = "none";
  2145. }
  2146. }
  2147. }
  2148. newTr.style.cursor="pointer";
  2149. newTr.style.backgroundColor = tr_bg_color_gen;
  2150. var newTd0=newTr.insertCell();
  2151. newTd0.colSpan="2";
  2152. newTd0.innerText="通用参数";
  2153. //通用参数
  2154. add_one_task_parm_to_table("model", "模型选择", g_train_task_parms["model"], newTr.id, "selection",str_type);
  2155. add_one_task_parm_to_table("pretrain_weights", "预训练模型", g_train_task_parms["pretrain_weights"], newTr.id, "selection");
  2156. add_one_task_parm_to_table("image_shape", "图像大小", g_train_task_parms["image_shape"], newTr.id);
  2157. add_one_task_parm_to_table("num_epochs", "迭代轮数", g_train_task_parms["num_epochs"], newTr.id);
  2158. add_one_task_parm_to_table("learning_rate", "学习率", g_train_task_parms["learning_rate"], newTr.id);
  2159. add_one_task_parm_to_table("batch_size", "批大小", g_train_task_parms["batch_size"], newTr.id);
  2160. add_one_task_parm_to_table("use_gpu", "是否使用GPU", "yes", newTr.id, "enable");
  2161. //高级参数
  2162. var rows = table_create_task.rows.length;
  2163. var newTr = table_create_task.insertRow(rows);
  2164. newTr.className = "parent_parm_row";
  2165. newTr.id = "advance_parm_row";
  2166. newTr.onclick=function()
  2167. {
  2168. for (i=0; i < table_create_task.rows.length; i++)
  2169. {
  2170. var obj_tr = table_create_task.rows[i];
  2171. if(obj_tr.className == "child_" + this.id)
  2172. {
  2173. if(obj_tr.style.display == "none")
  2174. obj_tr.style.display = "table-row";
  2175. else
  2176. obj_tr.style.display = "none";
  2177. }
  2178. }
  2179. }
  2180. newTr.style.cursor="pointer";
  2181. newTr.style.backgroundColor = tr_bg_color_adv;
  2182. var newTd0=newTr.insertCell();
  2183. newTd0.colSpan="2";
  2184. newTd0.innerText="高级参数";
  2185. add_one_task_parm_to_table("save_interval_epochs", "模型保存轮数", g_train_task_parms["save_interval_epochs"], newTr.id);
  2186. add_one_task_parm_to_table("lr_policy", "学习率下降方法", g_train_task_parms["lr_policy"], newTr.id, "selection");
  2187. add_one_task_parm_to_table("lr_decay_epochs", "学习率刷哀减轮数", g_train_task_parms["lr_decay_epochs"], newTr.id);
  2188. add_one_task_parm_to_table("image_mean", "图像均值", g_train_task_parms["image_mean"], newTr.id);
  2189. add_one_task_parm_to_table("image_std", "图像方差", g_train_task_parms["image_std"], newTr.id);
  2190. //数据增强策略
  2191. var rows = table_create_task.rows.length;
  2192. var newTr = table_create_task.insertRow(rows);
  2193. newTr.className = "parent_parm_row";
  2194. newTr.id = "augument_parm_row";
  2195. newTr.onclick=function()
  2196. {
  2197. for (i=0; i < table_create_task.rows.length; i++)
  2198. {
  2199. var obj_tr = table_create_task.rows[i];
  2200. if(obj_tr.className == "child_" + this.id)
  2201. {
  2202. if(obj_tr.style.display == "none")
  2203. obj_tr.style.display = "table-row";
  2204. else
  2205. obj_tr.style.display = "none";
  2206. }
  2207. }
  2208. }
  2209. newTr.style.cursor="pointer";
  2210. newTr.style.backgroundColor = tr_bg_color_aug;
  2211. var newTd0=newTr.insertCell();
  2212. newTd0.colSpan="2";
  2213. newTd0.innerText="数据增强策略";
  2214. add_one_task_parm_to_table("augument_enable", "随机亮度", "off", newTr.id, "switch");
  2215. add_one_task_parm_to_table("augument_enable", "随机对比度", "off", newTr.id, "switch");
  2216. add_one_task_parm_to_table("augument_enable", "随机水平翻转", "off", newTr.id, "switch");
  2217. add_one_task_parm_to_table("augument_enable", "随机垂直翻转", "off", newTr.id, "switch");
  2218. add_one_task_parm_to_table("augument_enable", "随机旋转", "off", newTr.id, "switch");
  2219. add_one_task_parm_to_table("augument_enable", "随机饱和度", "off", newTr.id, "switch");
  2220. add_one_task_parm_to_table("augument_enable", "随机色调", "off", newTr.id, "switch");
  2221. }
  2222. //增加一个训练参数到表格(text/select/enable/switch)
  2223. function add_one_task_parm_to_table(str_key, str_view, str_value, parent_key = "", parm_type = "text", task_type = "classification")
  2224. {
  2225. var rows = table_create_task.rows.length;
  2226. var bg_color = "background-color:#ffffff;"
  2227. if(rows % 2 == 0)
  2228. {
  2229. bg_color = "background-color:#f2f2f2;"
  2230. }
  2231. var newTr = table_create_task.insertRow(rows);
  2232. if(parent_key != "")
  2233. {
  2234. newTr.className = "child_" + parent_key;
  2235. newTr.id = "child_" + parent_key;
  2236. }
  2237. var newTd0=newTr.insertCell();
  2238. var newTd1=newTr.insertCell();
  2239. newTd0.innerHTML = str_view;
  2240. if(parm_type == "text")
  2241. {
  2242. newTd1.innerHTML = "<input id=\"task_detail_parm_" + str_key + "\" value=\"" + str_value + "\"" + "style=\"width:100%;height:20px;Float:left;border:none;outline:none;" + bg_color + "\" type=\"text\"/>";
  2243. }
  2244. else if (parm_type == "selection")
  2245. {
  2246. if(str_key == "model")
  2247. {
  2248. //任务类型
  2249. var str_list = Model_List[task_type];
  2250. var str_html = "<select id=\"task_detail_parm_" + str_key + "\" value=\"" + str_value + "\"" + "style=\"width:100%;height:20px;Float:left;border:none;outline:none;" + bg_color + "\">";
  2251. for(var i=0;i<str_list.length;i++)
  2252. {
  2253. if(str_value == str_list[i])
  2254. str_html = str_html + "<option value=\"" + str_list[i] + "\" selected=\"selected\">" + str_list[i] + "</option>";
  2255. else
  2256. str_html = str_html + "<option value=\"" + str_list[i] + "\">" + str_list[i] + "</option>";
  2257. }
  2258. str_html = str_html + "</select>";
  2259. newTd1.innerHTML = str_html;
  2260. }
  2261. else if (str_key == "pretrain_weights")
  2262. {
  2263. //预训练模型
  2264. var lst_pretrain_weights = get_pretrained_model_list("");
  2265. var str_html = "<select id=\"task_detail_parm_" + str_key + "\" value=\"" + str_value + "\"" + "style=\"width:100%;height:20px;Float:left;border:none;outline:none;" + bg_color + "\">";
  2266. for(var i=0;i<lst_pretrain_weights.length;i++)
  2267. {
  2268. if(str_value == lst_pretrain_weights[i])
  2269. str_html = str_html + "<option value=\"" + lst_pretrain_weights[i] + "\" selected=\"selected\">" + lst_pretrain_weights[i] + "</option>";
  2270. else
  2271. str_html = str_html + "<option value=\"" + lst_pretrain_weights[i] + "\">" + lst_pretrain_weights[i] + "</option>";
  2272. }
  2273. str_html = str_html + "</select>";
  2274. newTd1.innerHTML = str_html;
  2275. }
  2276. else if (str_key == "lr_policy")
  2277. {
  2278. //学习率哀减策略
  2279. var lst_lr_policy = get_lr_decay_list("");
  2280. var str_html = "<select id=\"task_detail_parm_" + str_key + "\" value=\"" + str_value + "\"" + "style=\"width:100%;height:20px;Float:left;border:none;outline:none;" + bg_color + "\">";
  2281. for(var i=0;i<lst_lr_policy.length;i++)
  2282. {
  2283. if(str_value == lst_lr_policy[i])
  2284. str_html = str_html + "<option value=\"" + lst_lr_policy[i] + "\" selected=\"selected\">" + lst_lr_policy[i] + "</option>";
  2285. else
  2286. str_html = str_html + "<option value=\"" + lst_lr_policy[i] + "\">" + lst_lr_policy[i] + "</option>";
  2287. }
  2288. str_html = str_html + "</select>";
  2289. newTd1.innerHTML = str_html;
  2290. }
  2291. }
  2292. else if (parm_type == "enable")
  2293. {
  2294. var str_html = "<select id=\"task_detail_parm_" + str_key + "\" value=\"" + str_value + "\"" + "style=\"width:100%;height:20px;Float:left;border:none;outline:none;" + bg_color + "\">";
  2295. if(str_value == "yes")
  2296. str_html = str_html + "<option value=\"" + "yes" + "\" selected=\"selected\">" + "是" + "</option>";
  2297. else
  2298. str_html = str_html + "<option value=\"" + "yes" + "\">" + "是" + "</option>";
  2299. if(str_value == "no")
  2300. str_html = str_html + "<option value=\"" + "no" + "\" selected=\"selected\">" + "否" + "</option>";
  2301. else
  2302. str_html = str_html + "<option value=\"" + "no" + "\">" + "否" + "</option>";
  2303. str_html = str_html + "</select>";
  2304. newTd1.innerHTML = str_html;
  2305. }
  2306. else if (parm_type == "switch")
  2307. {
  2308. var str_html = "<select id=\"task_detail_parm_" + str_key + "\" value=\"" + str_value + "\"" + "style=\"width:100%;height:20px;Float:left;border:none;outline:none;" + bg_color + "\">";
  2309. if(str_value == "on")
  2310. str_html = str_html + "<option value=\"" + "on" + "\" selected=\"selected\">" + "开" + "</option>";
  2311. else
  2312. str_html = str_html + "<option value=\"" + "on" + "\">" + "开" + "</option>";
  2313. if(str_value == "off")
  2314. str_html = str_html + "<option value=\"" + "off" + "\" selected=\"selected\">" + "关" + "</option>";
  2315. else
  2316. str_html = str_html + "<option value=\"" + "off" + "\">" + "关" + "</option>";
  2317. str_html = str_html + "</select>";
  2318. newTd1.innerHTML = str_html;
  2319. }
  2320. }
  2321. //预训练模型列表
  2322. function get_pretrained_model_list(str_model_name)
  2323. {
  2324. var lst_pretrained_model = ["IMAGENET","COCO","不使用预训练模型"];
  2325. return lst_pretrained_model;
  2326. }
  2327. //学习率哀减策略列表
  2328. function get_lr_decay_list(str_model_name)
  2329. {
  2330. var lst_lr_decay = ["Linear","Piecewise","Cosine"];
  2331. return lst_lr_decay;
  2332. }
  2333. //创建并启动任务训练
  2334. function create_task()
  2335. {
  2336. var input_create_task_prj_id = document.getElementById('create_task_project_id');
  2337. var str_project_id = input_create_task_prj_id.value;
  2338. var obj_btn = document.getElementById('btn_create_task');
  2339. if(obj_btn.value == "启动训练")
  2340. {
  2341. var str_start_tid = ""
  2342. var obj_init_task_input = document.getElementById('create_task_hidden_task_id');
  2343. str_start_tid = obj_init_task_input.value;
  2344. start_task(str_start_tid);
  2345. load_tasks();
  2346. hide_create_task_win_modal(null);
  2347. }
  2348. else if(obj_btn.value == "创建并启动训练")
  2349. {
  2350. var http_request = new XMLHttpRequest();
  2351. http_request.onreadystatechange=function()
  2352. {
  2353. if (http_request.readyState==4)
  2354. {
  2355. if (http_request.status==200)
  2356. {
  2357. alert("任务创建成功!\n" + http_request.responseText);
  2358. //调用训练接口启动任务训练
  2359. str_json = http_request.responseText;
  2360. var obj_json = eval('(' + str_json + ')');
  2361. var str_new_tid = obj_json["tid"];
  2362. start_task(str_new_tid);
  2363. load_tasks();
  2364. hide_create_task_win_modal(null);
  2365. }
  2366. else
  2367. {
  2368. alert("任务创建失败,请检查服务器配置" + http_request.responseText);
  2369. }
  2370. }
  2371. }
  2372. //获取训练参数
  2373. get_input_task_parm_value("num_epochs","int");
  2374. get_input_task_parm_value("batch_size","int");
  2375. get_input_task_parm_value("learning_rate","int");
  2376. //调用创建接口创建任务
  2377. //alert(JSON.stringify(g_train_task_parms));
  2378. var data = {"pid":str_project_id,"train":JSON.stringify(g_train_task_parms)};
  2379. http_request.open("POST", str_srv_url + "/project/task", true);
  2380. http_request.setRequestHeader("Content-type","application/json");
  2381. http_request.send(JSON.stringify(data));
  2382. }
  2383. }
  2384. //获取表格中模型训练参数
  2385. function get_input_task_parm_value(str_key, str_type="int")
  2386. {
  2387. var str_input_obj_key = "task_detail_parm_" + str_key;
  2388. var obj_task_parm_input = document.getElementById(str_input_obj_key);
  2389. var str_value = obj_task_parm_input.value;
  2390. if(str_type == "int")
  2391. {
  2392. g_train_task_parms[str_key] = parseInt(str_value);
  2393. }
  2394. else
  2395. {
  2396. g_train_task_parms[str_key] = str_value;
  2397. }
  2398. }
  2399. //启动训练任务
  2400. function start_task(tid)
  2401. {
  2402. var train_data = {"tid":tid};
  2403. var train_http_request = new XMLHttpRequest();
  2404. train_http_request.open("POST", str_srv_url + "/project/task/train", false);
  2405. train_http_request.setRequestHeader("Content-type","application/json");
  2406. train_http_request.send(JSON.stringify(train_data));
  2407. }
  2408. //查看单个项目下的所有任务
  2409. function view_project_tasks()
  2410. {
  2411. var obj_project_id = document.getElementById('popup_menu_project_id');
  2412. var str_project_id = obj_project_id.value;
  2413. g_view_project_task_id = str_project_id;
  2414. load_project_tasks(str_project_id);
  2415. }
  2416. //删除项目
  2417. function delete_project()
  2418. {
  2419. var obj_project_id = document.getElementById('popup_menu_project_id');
  2420. str_del_project_id = obj_project_id.value;
  2421. var result = confirm("删除项目:" + obj_project_id.value + " ?");
  2422. if(!result)
  2423. {
  2424. return;
  2425. }
  2426. var http_request = new XMLHttpRequest();
  2427. http_request.onreadystatechange=function()
  2428. {
  2429. if (http_request.readyState==4)
  2430. {
  2431. if (http_request.status==200)
  2432. {
  2433. alert("删除项目:" + str_del_project_id + "删除成功!\n" + http_request.responseText);
  2434. load_projects();
  2435. }
  2436. else
  2437. {
  2438. alert("项目" + str_del_project_id + "删除失败,请检查服务器配置" + http_request.responseText);
  2439. }
  2440. }
  2441. }
  2442. var data = {"pid":str_del_project_id};
  2443. http_request.open("DELETE", str_srv_url + "/project", true);
  2444. http_request.setRequestHeader("Content-type","application/json");
  2445. http_request.send(JSON.stringify(data));
  2446. }
  2447. //删除数据集
  2448. function delete_dataset()
  2449. {
  2450. var obj_dataset_id = document.getElementById('popup_menu_dataset_id');
  2451. str_del_dataset_id = obj_dataset_id.value;
  2452. var result = confirm("删除数据集:" + str_del_dataset_id + " ?");
  2453. if(!result)
  2454. {
  2455. return;
  2456. }
  2457. var http_request = new XMLHttpRequest();
  2458. http_request.onreadystatechange=function()
  2459. {
  2460. if (http_request.readyState==4)
  2461. {
  2462. if (http_request.status==200)
  2463. {
  2464. alert("删除数据集:" + str_del_dataset_id + "删除成功!\n" + http_request.responseText);
  2465. load_datasets();
  2466. }
  2467. else
  2468. {
  2469. alert("数据集" + str_del_dataset_id + "删除失败,请检查服务器配置" + http_request.responseText);
  2470. }
  2471. }
  2472. }
  2473. var data = {"did":str_del_dataset_id};
  2474. http_request.open("DELETE", str_srv_url + "/dataset", true);
  2475. http_request.setRequestHeader("Content-type","application/json");
  2476. http_request.send(JSON.stringify(data));
  2477. }
  2478. //中止任务
  2479. function stop_task()
  2480. {
  2481. var input_task_detail_id = document.getElementById('task_detail_id');
  2482. var str_stop_task_id = input_task_detail_id.value;
  2483. var result = confirm("确定终止任务:" + str_stop_task_id + " ?");
  2484. if(!result)
  2485. {
  2486. return;
  2487. }
  2488. var http_request = new XMLHttpRequest();
  2489. http_request.onreadystatechange=function()
  2490. {
  2491. if (http_request.readyState==4)
  2492. {
  2493. if (http_request.status==200)
  2494. {
  2495. alert("任务:" + str_stop_task_id + "中止成功!\n" + http_request.responseText);
  2496. hide_task_detail_info_win_modal();
  2497. load_tasks();
  2498. }
  2499. else
  2500. {
  2501. alert("任务:" + str_stop_task_id + "中止失败,请检查服务器配置" + http_request.responseText);
  2502. }
  2503. }
  2504. }
  2505. var data = {"tid":str_stop_task_id,"act":"stop"};
  2506. http_request.open("PUT", str_srv_url + "/project/task/train", true);
  2507. http_request.setRequestHeader("Content-type","application/json");
  2508. http_request.send(JSON.stringify(data));
  2509. }
  2510. //删除任务
  2511. function delete_task()
  2512. {
  2513. var obj_task_id = document.getElementById('popup_menu_task_id');
  2514. str_del_task_id = obj_task_id.value;
  2515. var result = confirm("删除任务:" + str_del_task_id + " ?");
  2516. if(!result)
  2517. {
  2518. return;
  2519. }
  2520. var http_request = new XMLHttpRequest();
  2521. http_request.onreadystatechange=function()
  2522. {
  2523. if (http_request.readyState==4)
  2524. {
  2525. if (http_request.status==200)
  2526. {
  2527. alert("删除任务:" + str_del_task_id + "删除成功!\n" + http_request.responseText);
  2528. load_tasks();
  2529. }
  2530. else
  2531. {
  2532. alert("任务" + str_del_task_id + "删除失败,请检查服务器配置" + http_request.responseText);
  2533. }
  2534. }
  2535. }
  2536. var data = {"tid":str_del_task_id};
  2537. http_request.open("DELETE", str_srv_url + "/project/task", true);
  2538. http_request.setRequestHeader("Content-type","application/json");
  2539. http_request.send(JSON.stringify(data));
  2540. }
  2541. //删除模型
  2542. function delete_model()
  2543. {
  2544. var obj_model_id = document.getElementById('popup_menu_model_id');
  2545. str_del_model_id = obj_model_id.value;
  2546. var result = confirm("删除模型:" + str_del_model_id + " ?");
  2547. if(!result)
  2548. {
  2549. return;
  2550. }
  2551. var http_request = new XMLHttpRequest();
  2552. http_request.onreadystatechange=function()
  2553. {
  2554. if (http_request.readyState==4)
  2555. {
  2556. if (http_request.status==200)
  2557. {
  2558. alert("删除模型:" + str_del_model_id + "删除成功!\n" + http_request.responseText);
  2559. load_models();
  2560. }
  2561. else
  2562. {
  2563. alert("模型" + str_del_model_id + "删除失败,请检查服务器配置" + http_request.responseText);
  2564. }
  2565. }
  2566. }
  2567. var data = {"emid":str_del_model_id, "type":"exported"};
  2568. http_request.open("DELETE", str_srv_url + "/model", true);
  2569. http_request.setRequestHeader("Content-type","application/json");
  2570. http_request.send(JSON.stringify(data));
  2571. }
  2572. //修改创建项目时下拉列表触发更新下拉数据集列表
  2573. function change_create_project_type(obj)
  2574. {
  2575. str_project_type = obj.value;
  2576. var obj_sel_create_project_dataset_id = document.getElementById('create_project_dataset_id_text');
  2577. obj_sel_create_project_dataset_id.options.length = 0;
  2578. obj_sel_create_project_dataset_id.options[0] = new Option("请选择项目对应数据集", 0);
  2579. for(var p in g_dataset_list)
  2580. {
  2581. str_id = g_dataset_list[p].id;
  2582. str_attr = g_dataset_list[p].attr;
  2583. str_name = str_attr["name"];
  2584. str_desc = str_attr["desc"];
  2585. str_type = str_attr["type"];
  2586. str_status = str_attr["dataset_status"]
  2587. //只有校验通过且切分后的数据集才可以选择
  2588. if(str_status == DatasetStatus.XSPLITED && str_type == str_project_type)
  2589. {
  2590. obj_sel_create_project_dataset_id.options[obj_sel_create_project_dataset_id.options.length] = new Option(str_name, str_id);
  2591. }
  2592. }
  2593. }
  2594. //ESC to close browse img window
  2595. function dispatch_key_press()
  2596. {
  2597. switch(event.keyCode)
  2598. {
  2599. //ESC
  2600. case 27:
  2601. {
  2602. hide_zoom_img(null);
  2603. }
  2604. }
  2605. }
  2606. </script>
  2607. </head>
  2608. <body onload="load_projects()" oncontextmenu="self.event.returnValue=false" onkeypress="dispatch_key_press()">
  2609. <!--popupmenu-->
  2610. <div id="popupmenu_project" class="popupmenu_project">
  2611. <input type="hidden" id="popup_menu_project_id">
  2612. <!--<input type="hidden" id="popup_menu_project_type">-->
  2613. <table border="0" width="100%" height="100%" cellspacing="0">
  2614. <tr>
  2615. <td style="cursor:default; border:solid #ccc 1px;" align="center" onclick="show_create_task_win_modal(this)">创建任务</td>
  2616. </tr>
  2617. <tr>
  2618. <td style="cursor:default; border:solid #ccc 1px;" align="center" onclick="view_project_tasks()">查看任务</td>
  2619. </tr>
  2620. <tr>
  2621. <td style="cursor:default; border:solid #ccc 1px;" align="center" onclick="delete_project()">删除项目</td>
  2622. </tr>
  2623. </table>
  2624. </div>
  2625. <div id="popupmenu_dataset" class="popupmenu_dataset">
  2626. <input type="hidden" id="popup_menu_dataset_id">
  2627. <table border="0" width="100%" height="100%" cellspacing="0">
  2628. <tr>
  2629. <td style="cursor:default; border:solid #ccc 1px;" align="center" onclick="delete_dataset(this)">删除数据集</td>
  2630. </tr>
  2631. </table>
  2632. </div>
  2633. <div id="popupmenu_task" class="popupmenu_task">
  2634. <input type="hidden" id="popup_menu_task_id">
  2635. <input type="hidden" id="popup_menu_task_status">
  2636. <table border="0" width="100%" height="100%" cellspacing="0">
  2637. <tr>
  2638. <td style="cursor:default; border:solid #ccc 1px;" align="center" onclick="delete_task(this)">删除任务</td>
  2639. </tr>
  2640. </table>
  2641. </div>
  2642. <div id="popupmenu_model" class="popupmenu_model">
  2643. <input type="hidden" id="popup_menu_model_id">
  2644. <table border="0" width="100%" height="100%" cellspacing="0">
  2645. <tr>
  2646. <td style="cursor:default; border:solid #ccc 1px;" align="center" onclick="delete_model(this)">删除模型</td>
  2647. </tr>
  2648. </table>
  2649. </div>
  2650. <!--main menu-->
  2651. <div class='nav'>
  2652. <ul>
  2653. <!--<li><div class="brand"> <a href="https://www.paddlepaddle.org.cn/paddle/paddleX"><img src="logo.png" alt="PaddleX Logo"></a></div></li>
  2654. <li>
  2655. <div class="navbar-btn" style="padding: 0; padding-top: 10px;">
  2656. <button type="button" class="btn-toggle-fullwidth btn-toggle-mx"><img src="img/left.png" height="40px" alt=""></button>
  2657. </div>
  2658. </li>
  2659. -->
  2660. <li><a href='https://www.paddlepaddle.org.cn/paddle/paddleX'>PaddleX主页</a></li>
  2661. <li><a href='#'>数据集管理</a>
  2662. <ul>
  2663. <li onclick="show_create_dataset_win_modal(this)"><a href='#'>创建数据集</a></li>
  2664. <li onclick="load_datasets()"><a href='#'>查看数据集</a></li>
  2665. </ul>
  2666. </li>
  2667. <li><a href='#'>项目管理</a>
  2668. <ul>
  2669. <li onclick="show_create_project_win_modal(this)"><a href='#'>创建项目</a></li>
  2670. <li onclick="load_projects()"><a href='#'>查看项目</a></li>
  2671. </ul>
  2672. </li>
  2673. <li><a href='#'>任务管理</a>
  2674. <ul>
  2675. <li onclick="load_tasks()"><a href='#'>查看所有任务</a></li>
  2676. </ul>
  2677. </li>
  2678. <li><a href='#'>模型管理</a>
  2679. <ul>
  2680. <!--<li><a href='#'>预训练模型</a></li>-->
  2681. <li onclick="load_models()"><a href='#'>已发布模型</a></li>
  2682. </ul>
  2683. </li>
  2684. <li onclick="show_server_info(this)"><a href='#'>服务器信息</a></li>
  2685. <li><a href='https://paddlex.readthedocs.io'>帮助文档</a></li>
  2686. <li onclick="contact_us()"><a href='#'>联系我们</a></li>
  2687. </ul>
  2688. </div>
  2689. <div style="text-align:center;clear:both;margin-top:10px">
  2690. <br>
  2691. <div id="div_demo_title"><h2><font color="#0000cd"> 欢迎使用 PaddleX RestfulAPI</font></h2></div>
  2692. <!--show projects/tasks/datasets/models information-->
  2693. <table width="100%" height="100%" align="center" cellspacing="20px" id="table_contents" style="font-size:18px; border:0px border-collapse:separate; border-spacing:10px 90px; solid #cad9ea;">
  2694. <tr>
  2695. <td>
  2696. <div id="draw-border">
  2697. <view_item id="btn_set_server" onclick="show_server_info(this)" style="width: 330px; height: 90px; align: center"><br><font color="red">连接服务器失败,点击设置服务器信息</font></view_item>
  2698. </div>
  2699. </td>
  2700. <td>
  2701. </tr>
  2702. </table>
  2703. <!--All hidden popup windows-->
  2704. <!--服务器配置弹出窗口-->
  2705. <div id="input_win_cfg_server" style="display:none;border:1px solid #cccccc;height:260px;width:50%;position:absolute;top:24%;left:24%;z-index:10;background:white;">
  2706. <!--title-->
  2707. <div style="position:relative;background-color: #529EFF;min_height:30px; max-height: 60px;border-bottom: 1px solid #a4acb9;padding:2px 2px;">
  2708. <br><div style="font-size: 20px;">配置服务器地址</div><br>
  2709. </div>
  2710. <br/>
  2711. <!--input information-->
  2712. <table width="100%" align="center" id="table_create_prj">
  2713. <tr>
  2714. <td><br><div style="font-size: 14px;">服务器地址:</div></td>
  2715. <td>
  2716. <br>
  2717. <input type="hidden" id="workspace_id">
  2718. <input id="server_url_text" style="width:85% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" />
  2719. </td>
  2720. </tr>
  2721. </table>
  2722. <br>
  2723. <!--buttons-->
  2724. <div style="margin-top: 15px; padding: 19px 20px 20px; text-align: right; border-top: 1px solid #e5e5e5;">
  2725. <div class="btn"><input type="button" id="btn_cancel_cfg_srv" style="background:#529EFF;" value="取消" onclick="hide_server_info(this);" /></div>
  2726. &nbsp;&nbsp;&nbsp;&nbsp;
  2727. <div class="btn"><input type="button" id="btn_cfg_srv" value="设置" onclick="set_server_addr(this);" /></div>
  2728. </div>
  2729. </div>
  2730. <div id="input_win_cfg_server_over" style="display: none;width: 100%;height: 100%;opacity:0.8;filter:alpha(opacity=80);position:absolute;top:0;left:0; z-index:9;background: silver;"></div>
  2731. <!--服务器配置弹出窗口-->
  2732. <!--创建项目弹出窗口-->
  2733. <div id="input_win_create_project" style="display:none;border:1px solid #cccccc;height:420px;width:50%;position:absolute;top:24%;left:24%;z-index:10;background:white;">
  2734. <!--title-->
  2735. <div style="position:relative;background-color: #529EFF;min_height:30px; max-height: 60px;border-bottom: 1px solid #a4acb9;padding:2px 2px;">
  2736. <br><div style="font-size: 20px;">新 建 项 目</div><br>
  2737. </div>
  2738. <br/>
  2739. <!--input informations-->
  2740. <table width="100%" align="center" id="table_create_prj">
  2741. <tr>
  2742. <td><br><div style="font-size: 14px;">项目名称:</div></td>
  2743. <td>
  2744. <br>
  2745. <input type="hidden" id="workspace_id_for_crt_prj">
  2746. <input id="project_name_text" value="新建项目" style="width:85% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" />
  2747. </td>
  2748. </tr>
  2749. <tr>
  2750. <td><br><div style="font-size: 14px;">项目类型:</div></td>
  2751. <td>
  2752. <br>
  2753. <select id="project_type_text" onchange="change_create_project_type(this);" style="width:89% ;height:30px;Float:left;padding: 4px 8px;margin-left: 4px;">
  2754. <option value="classification">图像分类</option>
  2755. <option value="detection">目标检测</option>
  2756. <option value="instance_segmentation">实例分割</option>
  2757. <option value="segmentation">语义分割</option>
  2758. </select>
  2759. </td>
  2760. </tr>
  2761. <tr>
  2762. <td><br><div style="font-size: 14px;">数据集:</div></td>
  2763. <td>
  2764. <br>
  2765. <select id="create_project_dataset_id_text" style="width:89% ;height:30px;Float:left;padding: 4px 8px;margin-left: 4px;">
  2766. <option value="0">请选择项目对应数据集</option>
  2767. </select>
  2768. </td>
  2769. </tr>
  2770. <tr>
  2771. <td><br><div style="font-size: 14px;">项目描述:</div></td>
  2772. <td>
  2773. <br>
  2774. <input id="project_desc_text" style="width:85% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" />
  2775. </td>
  2776. </tr>
  2777. </table>
  2778. <br>
  2779. <!--buttons-->
  2780. <div style="margin-top: 15px; padding: 19px 20px 20px; text-align: right; border-top: 1px solid #e5e5e5;">
  2781. <div class="btn"><input type="button" id="btn_cancel_create_prj" style="background:#529EFF;" value="取消" onclick="hide_create_prj_win_modal(this);" /></div>
  2782. &nbsp;&nbsp;&nbsp;&nbsp;
  2783. <div class="btn"><input type="button" id="btn_create_prj" value="创建" onclick="create_project(this);" /></div>
  2784. </div>
  2785. </div>
  2786. <div id="input_win_create_project_over" style="display: none;width: 100%;height: 100%;opacity:0.8;filter:alpha(opacity=80);position:absolute;top:0;left:0; z-index:9;background: silver;"></div>
  2787. <!--创建项目弹出窗口-->
  2788. <!--创建数据集弹出窗口-->
  2789. <div id="input_win_create_dataset" style="display:none;border:1px solid #cccccc;height:370px;width:50%;position:absolute;top:24%;left:24%;z-index:10;background:white;">
  2790. <!--title-->
  2791. <div style="position:relative;background-color: #529EFF;min_height:30px; max-height: 60px;border-bottom: 1px solid #a4acb9;padding:2px 2px;">
  2792. <br><div style="font-size: 20px;">新 建 数 据 集</div><br>
  2793. </div>
  2794. <br/>
  2795. <!--input informations-->
  2796. <table width="100%" align="center" id="table_create_dataset">
  2797. <tr>
  2798. <td><br><div style="font-size: 14px;">数据集名称:</div></td>
  2799. <td>
  2800. <br>
  2801. <input id="dataset_name_text" value="新建数据集" style="width:85% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" />
  2802. </td>
  2803. </tr>
  2804. <tr>
  2805. <td><br><div style="font-size: 14px;">数据集类型:</div></td>
  2806. <td>
  2807. <br>
  2808. <select id="dataset_type_text" style="width:89% ;height:30px;Float:left;padding: 4px 8px;margin-left: 4px;">
  2809. <option value="classification">图像分类</option>
  2810. <option value="detection">目标检测</option>
  2811. <option value="instance_segmentation">实例分割</option>
  2812. <option value="segmentation">语义分割</option>
  2813. </select>
  2814. </td>
  2815. </tr>
  2816. <tr>
  2817. <td><br><div style="font-size: 14px;">数据集描述:</div></td>
  2818. <td>
  2819. <br>
  2820. <input id="dataset_desc_text" style="width:85% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" />
  2821. </td>
  2822. </tr>
  2823. </table>
  2824. <br>
  2825. <!--buttons-->
  2826. <div style="margin-top: 15px; padding: 19px 20px 20px; text-align: right; border-top: 1px solid #e5e5e5;">
  2827. <div class="btn"><input type="button" id="btn_cancel_create_dataset" style="background:#529EFF;" value="取消" onclick="hide_create_dataset_win_modal(this);" /></div>
  2828. &nbsp;&nbsp;&nbsp;&nbsp;
  2829. <div class="btn"><input type="button" id="btn_create_dataset" value="创建" onclick="create_dataset(this);" /></div>
  2830. </div>
  2831. </div>
  2832. <div id="input_win_create_dataset_over" style="display: none;width: 100%;height: 100%;opacity:0.8;filter:alpha(opacity=80);position:absolute;top:0;left:0; z-index:9;background: silver;"></div>
  2833. <!--创建项目弹出窗口-->
  2834. <!--数据集导入弹出窗口-->
  2835. <div id="input_win_import_dataset" style="display:none;border:1px solid #cccccc;height:260px;width:50%;position:absolute;top:24%;left:24%;z-index:10;background:white;">
  2836. <!--title-->
  2837. <div style="position:relative;background-color: #529EFF;min_height:30px; max-height: 60px;border-bottom: 1px solid #a4acb9;padding:2px 2px;">
  2838. <br><div style="font-size: 20px;">导入数据集</div><br>
  2839. </div>
  2840. <br/>
  2841. <!--input informations-->
  2842. <table width="100%" align="center" id="table_import_dataset">
  2843. <tr>
  2844. <td><br><div style="font-size: 14px;">数据集路径:</div></td>
  2845. <td>
  2846. <br>
  2847. <input type="hidden" id="import_dataset_id" value="">
  2848. <input id="import_dataset_path_text" style="width:85% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" />
  2849. </td>
  2850. </tr>
  2851. </table>
  2852. <br>
  2853. <!--buttons-->
  2854. <div style="margin-top: 15px; padding: 19px 20px 20px; text-align: right; border-top: 1px solid #e5e5e5;">
  2855. <div class="btn"><input type="button" id="btn_cancel_import_dataset" style="background:#529EFF;" value="取消" onclick="hide_import_dataset_win_modal(this);" /></div>
  2856. &nbsp;&nbsp;&nbsp;&nbsp;
  2857. <div class="btn"><input type="button" id="btn_import_dataset" value="导入" onclick="import_dataset(this);" /></div>
  2858. </div>
  2859. </div>
  2860. <div id="input_win_import_dataset_over" style="display: none;width: 100%;height: 100%;opacity:0.8;filter:alpha(opacity=80);position:absolute;top:0;left:0; z-index:9;background: silver;"></div>
  2861. <!--数据集导入弹出窗口-->
  2862. <!--数据集切分弹出窗口-->
  2863. <div id="input_win_split_dataset" style="display:none;border:1px solid #cccccc;height:370px;width:50%;position:absolute;top:24%;left:24%;z-index:15;background:white;">
  2864. <!--title-->
  2865. <div style="position:relative;background-color: #529EFF;min_height:30px; max-height: 60px;border-bottom: 1px solid #a4acb9;padding:2px 2px;">
  2866. <br><div style="font-size: 20px;">切分数据集</div><br>
  2867. </div>
  2868. <br/>
  2869. <!--input informations-->
  2870. <table width="100%" align="center" id="table_split_dataset">
  2871. <tr>
  2872. <td><br><div style="font-size: 14px;">训练集(%):</div></td>
  2873. <td>
  2874. <br>
  2875. <input type="hidden" id="split_dataset_id" value="">
  2876. <input id="split_dataset_train_percent" value="70" oninput="value=value.replace(/(^\.|[^\d\.])/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^\d{3,}.*/,'100')" style="width:85% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" />
  2877. </td>
  2878. </tr>
  2879. <tr>
  2880. <td><br><div style="font-size: 14px;">验证集(%):</div></td>
  2881. <td>
  2882. <br>
  2883. <input id="split_dataset_val_percent" value="20" oninput="value=value.replace(/(^\.|[^\d\.])/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^\d{3,}.*/,'100')" style="width:85% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" />
  2884. </td>
  2885. </tr>
  2886. <tr>
  2887. <td><br><div style="font-size: 14px;">测试集(%):</div></td>
  2888. <td>
  2889. <br>
  2890. <input id="split_dataset_test_percent" value="10" oninput="value=value.replace(/(^\.|[^\d\.])/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.').replace(/^\d{3,}.*/,'100')" style="width:85% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" />
  2891. </td>
  2892. </tr>
  2893. </table>
  2894. <br>
  2895. <!--buttons-->
  2896. <div style="margin-top: 15px; padding: 19px 20px 20px; text-align: right; border-top: 1px solid #e5e5e5;">
  2897. <div class="btn"><input type="button" id="btn_cancel_split_dataset" style="background:#529EFF;" value="取消" onclick="hide_split_dataset_win_modal(this);" /></div>
  2898. &nbsp;&nbsp;&nbsp;&nbsp;
  2899. <div class="btn"><input type="button" id="btn_split_dataset" value="切分" onclick="split_dataset(this);" /></div>
  2900. </div>
  2901. </div>
  2902. <div id="input_win_split_dataset_over" style="display: none;width: 100%;height: 100%;opacity:0.8;filter:alpha(opacity=80);position:absolute;top:0;left:0; z-index:9;background: silver;"></div>
  2903. <!--数据集导入弹出窗口-->
  2904. <!--创建任务弹出窗口-->
  2905. <div id="input_win_create_task" style="display:none;border:1px solid #cccccc;height:400px;width:50%;position:absolute;top:24%;left:24%;z-index:15;background:white;overflow:auto">
  2906. <!--title-->
  2907. <div style="position:relative;background-color: #529EFF;min_height:30px; max-height: 60px;border-bottom: 1px solid #a4acb9;padding:2px 2px;">
  2908. <br><div style="font-size: 20px;">任务详细信息</div><br>
  2909. <input type="hidden" id="create_task_project_id" value="">
  2910. <input type="hidden" id="create_task_project_type" value="">
  2911. <input type="hidden" id="create_task_hidden_task_id" value="">
  2912. </div>
  2913. <!--input informations-->
  2914. <div class="scroll-content">
  2915. <div class="table-parms-head">
  2916. <table width="100%" align="center" id="table_create_task_head">
  2917. <colgroup><col style="font-size: 14px;"/><col/></colgroup>
  2918. <thead><tr><th>参数名</th><th>参数值</th></tr></thead>
  2919. </table>
  2920. </div>
  2921. <div class="table-parms-body">
  2922. <table width="100%" align="center" id="table_create_task">
  2923. <colgroup><col style="font-size: 14px;" /><col /></colgroup>
  2924. <tbody>
  2925. <tr><td>key</td><td>value</td></tr>
  2926. </tbody>
  2927. </table>
  2928. </div>
  2929. </div>
  2930. <br>
  2931. <!--buttons-->
  2932. <div style="margin-top: 15px; padding: 19px 20px 20px; text-align: right; border-top: 1px solid #e5e5e5;">
  2933. <div class="btn"><input type="button" id="btn_cancel_create_task" style="background:#529EFF;" value="取消" onclick="hide_create_task_win_modal(this);" /></div>
  2934. &nbsp;&nbsp;&nbsp;&nbsp;
  2935. <div class="btn"><input type="button" id="btn_create_task" value="创建并启动训练" onclick="create_task();" /></div>
  2936. </div>
  2937. </div>
  2938. <div id="input_win_create_task_over" style="display: none;width: 100%;height: 100%;opacity:0.8;filter:alpha(opacity=80);position:absolute;top:0;left:0; z-index:14;background: silver;"></div>
  2939. <!--创建任务弹出窗口-->
  2940. <!--任务状态窗口-->
  2941. <div id="task_detail_info" style="display:none;border:1px solid #cccccc;height:420px;width:50%;position:absolute;top:24%;left:24%;z-index:10;background:white;">
  2942. <!--title-->
  2943. <div style="position:relative;background-color: #529EFF;min_height:30px; max-height: 60px;border-bottom: 1px solid #a4acb9;padding:2px 2px;">
  2944. <br><div style="font-size: 20px;">查看任务状态</div><br>
  2945. </div>
  2946. <br/>
  2947. <!--input informations-->
  2948. <table width="100%" align="center" id="table_create_prj">
  2949. <tr>
  2950. <td><div style="font-size: 14px;">任务状态:</div></td>
  2951. <td>
  2952. <input type="hidden" id="task_detail_id">
  2953. <input id="task_detail_status_text" style="width:95% ;height:20px;Float:left;padding: 4px 8px; margin-left: 4px; border: none; outline: none;" type="text" readonly="readonly"/>
  2954. </td>
  2955. <td>&nbsp&nbsp</td>
  2956. </tr>
  2957. <tr>
  2958. <td><div style="font-size: 14px;">训练进度:</div></td>
  2959. <td>
  2960. <div class="progress"> <span id="task_detail_status_progress_bar_value" class="green" style="width: 0%;"><span id="task_detail_status_progress_bar">0%</span></span></div>
  2961. </td>
  2962. <td>&nbsp&nbsp</td>
  2963. </tr>
  2964. <tr>
  2965. <td><div style="font-size: 14px;">运行时间:</div></td>
  2966. <td>
  2967. <input id="task_detail_running_duration_text" style="width:95% ;height:20px;Float:left;padding: 4px 8px; margin-left: 4px; border: none; outline: none;" type="text" readonly="readonly"/>
  2968. </td>
  2969. <td>&nbsp&nbsp</td>
  2970. </tr>
  2971. <tr>
  2972. <td><div style="font-size: 14px;">VDL可视化数据:</div></td>
  2973. <td>
  2974. <input id="task_detail_vdl_text" value="点击查看" onclick="open_task_vdl_window(this);" style="color: #0000cd; width:95% ;height:20px;Float:left;padding: 4px 8px; margin-left: 4px; border: none; outline: none;" type="text" readonly="readonly"/>
  2975. </td>
  2976. <td>&nbsp&nbsp</td>
  2977. </tr>
  2978. <tr>
  2979. <td><div style="font-size: 14px;">任务信息:</div></td>
  2980. <td>
  2981. <textarea id="task_detail_log_text" style="width:95% ;height:100px; resize:none" readonly="readonly"></textarea>
  2982. </td>
  2983. <td>&nbsp&nbsp</td>
  2984. </tr>
  2985. </table>
  2986. <!--buttons-->
  2987. <div style="margin-top: 15px; padding: 19px 20px 20px; text-align: right; border-top: 1px solid #e5e5e5;">
  2988. <!--停止任务,当任务运行中可点击-->
  2989. <div class="btn" id="div_btn_stop_task" style="visibility:hidden;"><input type="button" id="btn_stop_task_info" style="background:#FF2600;" value="中止训练" onclick="stop_task();" /></div>
  2990. &nbsp;&nbsp;&nbsp;&nbsp;
  2991. <div class="btn"><input type="button" id="btn_cancel_task_info" style="background:#529EFF;" value="取消" onclick="hide_task_detail_info_win_modal();" /></div>
  2992. &nbsp;&nbsp;&nbsp;&nbsp;
  2993. <div class="btn"><input type="button" id="btn_next_task_info" value="关闭" onclick="task_next_step_process(this);" /></div>
  2994. </div>
  2995. </div>
  2996. <div id="task_detail_info_over" style="display: none;width: 100%;height: 100%;opacity:0.8;filter:alpha(opacity=80);position:absolute;top:0;left:0;z-index:9;background: silver;"></div>
  2997. <!--任务状态窗口-->
  2998. <!--评估&导出模型窗口-->
  2999. <div id="input_win_evaluate_export_model" style="display:none;border:1px solid #cccccc;height:260px;width:50%;position:absolute;top:24%;left:24%;z-index:10;background:white;">
  3000. <!--title-->
  3001. <div style="position:relative;background-color: #529EFF;min_height:30px; max-height: 60px;border-bottom: 1px solid #a4acb9;padding:2px 2px;">
  3002. <br><div style="font-size: 20px;">模型评估&导出</div><br>
  3003. </div>
  3004. <br/>
  3005. <!--input informations-->
  3006. <table width="100%" align="center" id="table_evaluate_export_model">
  3007. <tr>
  3008. <td><br><div style="font-size: 14px;">导出路径:</div></td>
  3009. <td>
  3010. <br>
  3011. <input type="hidden" id="evaluate_export_task_id" value="">
  3012. <input type="hidden" id="evaluate_export_task_project_id" value="">
  3013. <input id="export_model_path_text" style="width:85% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" />
  3014. </td>
  3015. </tr>
  3016. </table>
  3017. <br>
  3018. <!--buttons-->
  3019. <div style="margin-top: 15px; padding: 19px 20px 20px; text-align: right; border-top: 1px solid #e5e5e5;">
  3020. <!--评估任务-->
  3021. <div class="btn"><input type="button" id="btn_cancel_evaluate_export" style="background:#529EFF;" value="取消" onclick="hide_evaluate_export_win_modal(this);" /></div>
  3022. &nbsp;&nbsp;&nbsp;&nbsp;
  3023. <div class="btn" id="div_btn_evaluate_task"><input type="button" id="btn_evaluate_task_info" style="background:#008F00;" value="启动评估" onclick="evaluate_task(this);" /></div>
  3024. &nbsp;&nbsp;&nbsp;&nbsp;
  3025. <div class="btn"><input type="button" id="btn_close_evaluate_export" value="导出" onclick="export_model(this);" /></div>
  3026. </div>
  3027. </div>
  3028. <div id="input_win_evaluate_export_model_over" style="display: none;width: 100%;height: 100%;opacity:0.8;filter:alpha(opacity=80);position:absolute;top:0;left:0; z-index:9;background: silver;"></div>
  3029. <!--评估&导出模型窗口-->
  3030. <!--浏览数据集弹出窗口-->
  3031. <div id="win_browse_dataset" style="display:none;border:1px solid #cccccc;height:520px;width:60%;position:absolute;top:16%;left:20%;z-index:10;background:white;">
  3032. <!--title-->
  3033. <div style="position:relative;background-color: #529EFF;min_height:30px; max-height: 60px;border-bottom: 1px solid #a4acb9;padding:2px 2px;">
  3034. <br><div style="font-size: 20px;">浏 览 数 据 集</div><br>
  3035. </div>
  3036. <br/>
  3037. <!--show dataset informations-->
  3038. <table width="100%" align="center" id="table_create_dataset">
  3039. <tr>
  3040. <td><div style="font-size: 14px;">数据集名称:</div></td>
  3041. <td>
  3042. <input type="hidden" id="browse_dataset_id" value="">
  3043. <input id="browse_dataset_name_text" value="" style="width:90% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" readonly="readonly"/>
  3044. </td>
  3045. <td><div style="font-size: 14px;">数据集类型:</div></td>
  3046. <td>
  3047. <input id="browse_dataset_type_text" value="" style="width:90% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" readonly="readonly"/>
  3048. </td>
  3049. </tr>
  3050. <tr>
  3051. <td><div style="font-size: 14px;">数据集描述:</div></td>
  3052. <td colspan = "3">
  3053. <input id="browse_dataset_desc_text" style="width:96% ;height:20px;Float:left;padding: 4px 8px;margin-left: 4px;" type="text" readonly="readonly"/>
  3054. </td>
  3055. </tr>
  3056. </table>
  3057. <br>
  3058. <!--数据预览-->
  3059. <div class="scroll-content">
  3060. <div>
  3061. <table width="100%" align="center" id="table_browse_dataset_head">
  3062. <tr>
  3063. <th width="50%">全部标签</th>
  3064. <th width="50%">全部数据预览 &nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp<label id="dataset_chk_show_label_txt"><input type="checkbox" id="dataset_chk_show_label" value="显示标注" onclick="show_dataset_labels()" style="height: 12px;width: 12px;">&nbsp;显示标注</label></th>
  3065. </tr>
  3066. </table>
  3067. </div>
  3068. <div>
  3069. <table width="100%" align="center" id="table_browse_dataset">
  3070. <tr>
  3071. <td>
  3072. <!--标签-->
  3073. <div class="table-dataset-labels">
  3074. <table width="100%" align="center" id="table_dataset_labels">
  3075. <colgroup><col style="font-size: 14px;" /><col /></colgroup>
  3076. <tbody>
  3077. <tr><td>标签名称</td><td>总数据量</td><td>训练数据集</td><td>验证数据集</td><td>测试数据集</td></tr>
  3078. </tbody>
  3079. </table>
  3080. </div>
  3081. <!--标签-->
  3082. </td>
  3083. <td>
  3084. <!--图像预览-->
  3085. <div class="table-dataset-labels">
  3086. <table width="100%" align="center" id="table_dataset_imgs">
  3087. <tr>
  3088. <td><img id="dataset_img_1" src="" ondblclick="zoom_image(this)" align="center" style="border:1px #D6D6D6 solid;" height="150" width="150" hspace="0" vspace="0"/></td>
  3089. <td><img id="dataset_img_2" src="" ondblclick="zoom_image(this)" align="center" style="border:1px #D6D6D6 solid;" height="150" width="150" hspace="0" vspace="0"/></td>
  3090. <td><img id="dataset_img_3" src="" ondblclick="zoom_image(this)" align="center" style="border:1px #D6D6D6 solid;" height="150" width="150" hspace="0" vspace="0"/></td>
  3091. </tr>
  3092. <tr>
  3093. <td id="dataset_img_1_file_name">img_file</td>
  3094. <td id="dataset_img_2_file_name">img_file</td>
  3095. <td id="dataset_img_3_file_name">img_file</td>
  3096. </tr>
  3097. </table>
  3098. <table width="100%" align="center" id="table_dataset_pages">
  3099. <tr>
  3100. <td style="cursor:pointer;" onclick="dataset_pre_page()">上一页</td>
  3101. <td id="dataset_page_info">第 页/共 页<td>
  3102. <td style="cursor:pointer;" onclick="dataset_next_page()">下一页</td>
  3103. </tr>
  3104. </table>
  3105. </div>
  3106. </td>
  3107. </tr>
  3108. </table>
  3109. </div>
  3110. </div>
  3111. <br>
  3112. <!--buttons-->
  3113. <div style="margin-top: 15px; padding: 19px 20px 20px; text-align: right; border-top: 1px solid #e5e5e5;">
  3114. <div class="btn"><input type="button" id="btn_cancel_browse_dataset" style="background:#529EFF;" value="取消" onclick="hide_browse_dataset_win_modal(this);" /></div>
  3115. &nbsp;&nbsp;&nbsp;&nbsp;
  3116. <div class="btn"><input type="button" id="btn_split_dataset" style="background:#008F00;" value="重新切分" onclick="re_split_dataset(this);" /></div>
  3117. &nbsp;&nbsp;&nbsp;&nbsp;
  3118. <div class="btn"><input type="button" id="btn_close_browse_dataset" value="关闭" onclick="hide_browse_dataset_win_modal(this);" /></div>
  3119. </div>
  3120. </div>
  3121. <div id="win_browse_dataset_over" style="display: none;width: 100%;height: 100%;opacity:0.8;filter:alpha(opacity=80);position:absolute;top:0;left:0; z-index:9;background: silver;"></div>
  3122. <!--浏览原图弹出窗口-->
  3123. <div id="win_browse_img" onclick="hide_zoom_img(this)" style="display:none;border:1px solid #cccccc;height:610px;width:60%;position:absolute;top:15%;left:20%;z-index:15;background:white;">
  3124. <table width="100%" align="center" id="table_img">
  3125. <tr>
  3126. <td>
  3127. <img id="dataset_browse_img" onclick="hide_zoom_img(this)" src="" align="center" style="border:1px #D6D6D6 solid;" height="600" width="600" hspace="0" vspace="0"/>
  3128. </td>
  3129. </tr>
  3130. </table>
  3131. </div>
  3132. <div id="win_browse_img_over" style="display: none;width: 100%;height: 100%;opacity:0.8;filter:alpha(opacity=80);position:absolute;top:0;left:0; z-index:9;background: silver;"></div>
  3133. <!--浏览原图弹出窗口-->
  3134. <div class="btn">
  3135. <input type="button" id="btn_refresh" style="width: 150px; height: 50px; " value="刷新项目信息" onclick="javascript:refresh_contents(this);"/>
  3136. </div>
  3137. <br>
  3138. </body>
  3139. </html>