v.chiang001 commited on
Commit
3c49e25
·
1 Parent(s): 4308783

fix the links to different files

Browse files
__pycache__/save_results.cpython-38.pyc ADDED
Binary file (1.47 kB). View file
 
app.py CHANGED
@@ -411,6 +411,7 @@ outputs = [gr_image_output,out_smpl_npy_download]
411
 
412
 
413
  ##############################################
 
414
  # User interace: description
415
  gr_title = "megadetdlc TRIALLING"
416
  gr_description = "Contributed by Sofia Minano, Neslihan Wittek, Nirel Kadzo, VicShaoChih Chiang -- DLC AI Residents 2022..\
@@ -427,9 +428,10 @@ demo = gr.Interface(predict_pipeline,
427
  outputs=outputs,
428
  title=gr_title,
429
  description=gr_description,
430
- examples=examples,
431
  theme="huggingface",
432
  #live=True
433
  )
434
 
435
  demo.launch(enable_queue=True, share=True)
 
 
 
411
 
412
 
413
  ##############################################
414
+ # %%
415
  # User interace: description
416
  gr_title = "megadetdlc TRIALLING"
417
  gr_description = "Contributed by Sofia Minano, Neslihan Wittek, Nirel Kadzo, VicShaoChih Chiang -- DLC AI Residents 2022..\
 
428
  outputs=outputs,
429
  title=gr_title,
430
  description=gr_description,
 
431
  theme="huggingface",
432
  #live=True
433
  )
434
 
435
  demo.launch(enable_queue=True, share=True)
436
+
437
+ # %%
dlcmodel/__pycache__/models.cpython-38.pyc CHANGED
Binary files a/dlcmodel/__pycache__/models.cpython-38.pyc and b/dlcmodel/__pycache__/models.cpython-38.pyc differ
 
dlcmodel/models.py CHANGED
@@ -33,7 +33,7 @@ def DownloadModel(modelname, target_dir):
33
  member.path = member.path[l:]
34
  yield member
35
 
36
- neturls = read_plainconfig("/dlcmodel/pretrained_model_urls.yaml") #FIXME
37
 
38
  if modelname in neturls.keys():
39
  url = neturls[modelname]
 
33
  member.path = member.path[l:]
34
  yield member
35
 
36
+ neturls = read_plainconfig("dlcmodel/pretrained_model_urls.yaml") #FIXME
37
 
38
  if modelname in neturls.keys():
39
  url = neturls[modelname]
gradio_queue.db ADDED
Binary file (176 kB). View file
 
save_results.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import numpy as np
3
+ import pdb
4
+
5
+ dict_pred = {0: 'animal', 1: 'person', 2: 'vehicle'}
6
+
7
+
8
+ def save_results(md_results, dlc_outputs,map_label_id_to_str,thr,output_file = 'dowload_predictions.json'):
9
+
10
+ """
11
+ write json
12
+ """
13
+ info = {}
14
+ ## info megaDetector
15
+ info['file']= md_results.files[0]
16
+ number_bb = len(md_results.xyxy[0].tolist())
17
+ info['number_of_bb'] = number_bb
18
+ number_bb_thr = len(dlc_outputs)
19
+ labels = [n for n in map_label_id_to_str.values()]
20
+ #pdb.set_trace()
21
+ new_index = []
22
+ for i in range(number_bb):
23
+ corner_x1,corner_y1,corner_x2,corner_y2,confidence, _ = md_results.xyxy[0].tolist()[i]
24
+
25
+ if confidence > thr:
26
+ new_index.append(i)
27
+
28
+
29
+ for i in range(number_bb_thr):
30
+ aux={}
31
+ corner_x1,corner_y1,corner_x2,corner_y2,confidence, _ = md_results.xyxy[0].tolist()[new_index[i]]
32
+ aux['corner_1'] = (corner_x1,corner_y1)
33
+ aux['corner_2'] = (corner_x2,corner_y2)
34
+ aux['predict MD'] = md_results.names[0]
35
+ aux['confidence MD'] = confidence
36
+
37
+ ## info dlc
38
+ kypts = []
39
+ pdb.set_trace()
40
+ for s in dlc_outputs[i]:
41
+ #print(s)
42
+ aux1 = []
43
+ for j in s:
44
+ aux1.append(float(j))
45
+
46
+ kypts.append(aux1)
47
+ pdb.set_trace()
48
+ aux['dlc_pred'] = dict(zip(labels,kypts))
49
+ info['bb_' + str(new_index[i]) ]=aux
50
+
51
+
52
+ with open(output_file, 'w') as f:
53
+ json.dump(info, f, indent=1)
54
+ print('Output file saved at {}'.format(output_file))
55
+
56
+ return output_file