Medha Sawhney commited on
Commit
dbf8ccd
·
1 Parent(s): e7ecdfa

updating requirements.txt

Browse files
Files changed (2) hide show
  1. app.py +44 -44
  2. requirements.txt +1 -1
app.py CHANGED
@@ -88,59 +88,59 @@ def doo(video, progress=gr.Progress()):
88
  feature_data_path = os.path.join(feature_dir, exp_name)
89
 
90
 
91
- # #path to saved models
92
- # no_motility_model_path = "models/motility/no/collagen_optical_flow_median_bkg_more_data_90k/"
93
- # low_motility_model_path = "models/motility/low/collagen_optical_flow_median_bkg_more_data_90k/"
94
- # mid_motility_model_path = "models/motility/mid/collagen_optical_flow_median_bkg_more_data_90k/"
95
- # high_motility_model_path = "models/motility/high/collagen_optical_flow_median_bkg_more_data_90k/"
96
 
97
 
98
- # # Clear previous results and data
99
- # if os.path.exists(final_data_dir):
100
- # shutil.rmtree(final_data_dir)
101
- # if os.path.exists(raw_frame_dir):
102
- # shutil.rmtree(raw_frame_dir)
103
- # if os.path.exists(feature_dir):
104
- # shutil.rmtree(feature_dir)
105
 
106
- # # Read video and store frames separately for object detection model
107
- # video_dir = read_video(video, raw_frame_dir, progress=gr.Progress())
108
- # # Process raw frames and store in acceptable format
109
- # progress(1 / 3, desc=f"Processing Frames {1}/{3}")
110
- # video_num = process_data(video_dir, raw_frame_dir, final_data_dir, out_sub_dir)
111
- # progress(3 / 3, desc=f"Processing Frames {3}/{3}")
112
- # # generate features for raw frames for the object detector model
113
- # progress(1 / 3, desc=f"Generating Features {1}/{3}")
114
- # create_test_data(target_data_sub_dir, feature_dir, exp_name, test_video_list)
115
- # progress(3 / 3, desc=f"Features Generated {3}/{3}")
116
 
117
 
118
- # progress(1 / 3, desc=f"Loading Models {1}/{3}")
119
- # # Run Object Detection Code
120
- # for video_num in [1]:
121
- # #To genearate testing files for all motilities
122
- # run_inference(video_num=video_num, output_dir=no_motility_model_path,
123
- # annotations_test="All", test_dir=feature_data_path, register_dataset=True)
124
- # progress(3 / 3, desc=f"Models Loaded{3}/{3}")
125
- # run_inference(video_num=video_num, output_dir=mid_motility_model_path,
126
- # annotations_test="Motility-mid", test_dir=feature_data_path, register_dataset=False)
127
- # progress(1 / 3, desc=f"Running Bacteria Detection {1}/{3}")
128
 
129
- # run_inference(video_num=video_num, output_dir=high_motility_model_path,
130
- # annotations_test="Motility-high", test_dir=feature_data_path, register_dataset=False)
131
- # progress(2 / 3, desc=f"Running Bacteria Detection {2}/{3}")
132
 
133
- # run_inference(video_num=video_num, output_dir=low_motility_model_path,
134
- # annotations_test="Motility-low", test_dir=feature_data_path, register_dataset=False)
135
- # progress(3 / 3, desc=f"Running Bacteria Detection {3}/{3}")
136
 
137
- # # Tracking where GT is present
138
- # progress(0 / 3, desc=f"Tracking {0}/{3}")
139
  for video_num in [1]:
140
- # gen_tracking_data(video_num=video_num, data_path=feature_data_path, filter_thresh=0.3)
141
- # progress(1 / 3, desc=f"Tracking {1}/{3}")
142
- # track_bacteria(video_num=video_num, max_age=35, max_interpolation=35, data_path=feature_data_path)
143
- # progress(2 / 3, desc=f"Tracking {2}/{3}")
144
  folder_path = analyse_tracking(video_num=video_num, data_feature_path=feature_data_path, data_root_path=final_data_dir, plot=True)
145
  progress(3 / 3, desc=f"Tracking {3}/{3}")
146
  output_video = gen_tracking_video(video_num=video_num, fps=60, data_path=feature_data_path)
 
88
  feature_data_path = os.path.join(feature_dir, exp_name)
89
 
90
 
91
+ #path to saved models
92
+ no_motility_model_path = "models/motility/no/collagen_optical_flow_median_bkg_more_data_90k/"
93
+ low_motility_model_path = "models/motility/low/collagen_optical_flow_median_bkg_more_data_90k/"
94
+ mid_motility_model_path = "models/motility/mid/collagen_optical_flow_median_bkg_more_data_90k/"
95
+ high_motility_model_path = "models/motility/high/collagen_optical_flow_median_bkg_more_data_90k/"
96
 
97
 
98
+ # Clear previous results and data
99
+ if os.path.exists(final_data_dir):
100
+ shutil.rmtree(final_data_dir)
101
+ if os.path.exists(raw_frame_dir):
102
+ shutil.rmtree(raw_frame_dir)
103
+ if os.path.exists(feature_dir):
104
+ shutil.rmtree(feature_dir)
105
 
106
+ # Read video and store frames separately for object detection model
107
+ video_dir = read_video(video, raw_frame_dir, progress=gr.Progress())
108
+ # Process raw frames and store in acceptable format
109
+ progress(1 / 3, desc=f"Processing Frames {1}/{3}")
110
+ video_num = process_data(video_dir, raw_frame_dir, final_data_dir, out_sub_dir)
111
+ progress(3 / 3, desc=f"Processing Frames {3}/{3}")
112
+ # generate features for raw frames for the object detector model
113
+ progress(1 / 3, desc=f"Generating Features {1}/{3}")
114
+ create_test_data(target_data_sub_dir, feature_dir, exp_name, test_video_list)
115
+ progress(3 / 3, desc=f"Features Generated {3}/{3}")
116
 
117
 
118
+ progress(1 / 3, desc=f"Loading Models {1}/{3}")
119
+ # Run Object Detection Code
120
+ for video_num in [1]:
121
+ #To genearate testing files for all motilities
122
+ run_inference(video_num=video_num, output_dir=no_motility_model_path,
123
+ annotations_test="All", test_dir=feature_data_path, register_dataset=True)
124
+ progress(3 / 3, desc=f"Models Loaded{3}/{3}")
125
+ run_inference(video_num=video_num, output_dir=mid_motility_model_path,
126
+ annotations_test="Motility-mid", test_dir=feature_data_path, register_dataset=False)
127
+ progress(1 / 3, desc=f"Running Bacteria Detection {1}/{3}")
128
 
129
+ run_inference(video_num=video_num, output_dir=high_motility_model_path,
130
+ annotations_test="Motility-high", test_dir=feature_data_path, register_dataset=False)
131
+ progress(2 / 3, desc=f"Running Bacteria Detection {2}/{3}")
132
 
133
+ run_inference(video_num=video_num, output_dir=low_motility_model_path,
134
+ annotations_test="Motility-low", test_dir=feature_data_path, register_dataset=False)
135
+ progress(3 / 3, desc=f"Running Bacteria Detection {3}/{3}")
136
 
137
+ # Tracking where GT is present
138
+ progress(0 / 3, desc=f"Tracking {0}/{3}")
139
  for video_num in [1]:
140
+ gen_tracking_data(video_num=video_num, data_path=feature_data_path, filter_thresh=0.3)
141
+ progress(1 / 3, desc=f"Tracking {1}/{3}")
142
+ track_bacteria(video_num=video_num, max_age=35, max_interpolation=35, data_path=feature_data_path)
143
+ progress(2 / 3, desc=f"Tracking {2}/{3}")
144
  folder_path = analyse_tracking(video_num=video_num, data_feature_path=feature_data_path, data_root_path=final_data_dir, plot=True)
145
  progress(3 / 3, desc=f"Tracking {3}/{3}")
146
  output_video = gen_tracking_video(video_num=video_num, fps=60, data_path=feature_data_path)
requirements.txt CHANGED
@@ -29,7 +29,7 @@ openpyxl
29
  pandas==1.1.5
30
  plotly==5.11.0
31
  scikit-image
32
- scikit-learn==1.12
33
  scipy==1.5.4
34
  seaborn==0.11.2
35
  torch==1.9.1
 
29
  pandas==1.1.5
30
  plotly==5.11.0
31
  scikit-image
32
+ #scikit-learn==1.12
33
  scipy==1.5.4
34
  seaborn==0.11.2
35
  torch==1.9.1