List of commits:
Subject Hash Author Date (UTC)
abs clamp 524c6f7196908527367ddcbfc340107e4092cc6e Thai Thien 2020-12-06 11:16:12
use abs instead of ssim 92226d63c9732e66bf50f0b78e61f915ad2bce77 Thai Thien 2020-12-06 10:56:56
claim both y and y_pred d1f6764a691fc2f2f1adc63ae65d63a8347d8a45 Thai Thien 2020-12-06 10:52:14
clamp 0.0 5569f7dad3c9e792e65636bb29b66a84ff250282 Thai Thien 2020-12-06 10:46:57
dataloader target crop e41c17147de7c05f213329009c7662fbb2f1dc91 Thai Thien 2020-12-06 10:43:12
clamp min = 0 5245898e5282aa4cdc4b6539e68cb36a1c2d0c1f Thai Thien 2020-12-06 10:40:47
fix metric 9739b99b836657377eb9dce05fafeef4a90546e9 Thai Thien 2020-12-06 10:38:37
eval density d02232a419cd22bc79e0325c1c6791a7e5fc15b0 Thai Thien 2020-12-06 10:37:22
. 926498e13908770b072aeca0ccecbf5d3a64808e Thai Thien 2020-12-06 10:27:13
if self.dataset_name == "shanghaitech_non_overlap_test_with_densitygt" and not self.train: ca2bf6f9372ccdd5b880f2dd7be2023840afdd1d Thai Thien 2020-12-06 10:24:21
yeah forgot to change ds name bfdf3cfe27be5f51de300e231b6b79f903a71624 Thai Thien 2020-12-06 10:17:37
eval_only mode should not save bf03ec80b43e070501c043f7428d55d8409b960c Thai Thien 2020-12-06 10:14:22
now we output density map for testing fb1f9f1c8abeb2311f0637db5f7b4c4ca4b43810 Thai Thien 2020-12-06 10:12:01
predict 8a312e6bcbe7a8b726cf1a01497db09bc21fea51 Thai Thien 2020-12-06 09:57:58
go ssim and psnr d9b0d9c0417835c51ea59c66d85b8821480d0357 Thai Thien 2020-12-06 09:36:21
t4 624c9948c2099f16bd66f30a0c18093367b8a113 Thai Thien 2020-12-06 03:59:20
adamw1_ccnnv7_t3_bike 944e85901a2c22fd09f771cd1dd295f5a0ead80b Thai Thien 2020-12-06 03:51:57
train ccnn baseline on mybike ds 72d6a45b37523136c36ef208e7c9ab0893bce3da Thai Thien 2020-12-06 03:25:17
my collate on my bike 748f11c4b2ddbd37e5dda3b9472558fa49689c1f Thai Thien 2020-12-05 19:06:48
pump up the epoch 5b4e119e1f1eaf56d51e0dba9dd89ecc2a38ad5b Thai Thien 2020-12-05 19:03:41
Commit 524c6f7196908527367ddcbfc340107e4092cc6e - abs clamp
Author: Thai Thien
Author date (UTC): 2020-12-06 11:16
Committer name: Thai Thien
Committer date (UTC): 2020-12-06 11:16
Parent(s): 92226d63c9732e66bf50f0b78e61f915ad2bce77
Signer:
Signing key:
Signing status: N
Tree: 7c314cdf1e0581eccbb72774ffddcd08908910c8
File Lines added Lines deleted
crowd_counting_error_metrics.py 64 2
experiment_main.py 18 7
File crowd_counting_error_metrics.py changed (mode: 100644) (index ea8ceba..f8d2d31)
... ... class CrowdCountingMeanSquaredErrorWithCount(Metric):
112 112 import piq import piq
113 113
114 114
115 class CrowdCountingMeanSSIM(Metric):
115 class CrowdCountingMeanSSIMabs(Metric):
116 116 """ """
117 117 Calculates ssim Calculates ssim
118 118 require package https://github.com/photosynthesis-team/piq require package https://github.com/photosynthesis-team/piq
 
... ... class CrowdCountingMeanSSIM(Metric):
144 144 return self._sum / self._num_examples return self._sum / self._num_examples
145 145
146 146
147 class CrowdCountingMeanPSNR(Metric):
147 class CrowdCountingMeanPSNRabs(Metric):
148 148 """ """
149 149 Calculates ssim Calculates ssim
150 150 require package https://github.com/photosynthesis-team/piq require package https://github.com/photosynthesis-team/piq
 
... ... class CrowdCountingMeanPSNR(Metric):
176 176 raise NotComputableError('CrowdCountingMeanPSNR must have at least one example before it can be computed.') raise NotComputableError('CrowdCountingMeanPSNR must have at least one example before it can be computed.')
177 177 return self._sum / self._num_examples return self._sum / self._num_examples
178 178
179 #################3
180
181
182 class CrowdCountingMeanSSIMclamp(Metric):
183 """
184 Calculates ssim
185 require package https://github.com/photosynthesis-team/piq
186 - `update` must receive output of the form `(y_pred, y)`.
187 """
188 def reset(self):
189 self._sum = 0.0
190 self._num_examples = 0
191
192 def update(self, output):
193 y_pred = output[0]
194 y = output[1]
195 y_pred = torch.clamp_min(y_pred, min=0.0)
196 y = torch.clamp_min(y, min=0.0)
197
198
199 ssim_metric = piq.ssim(y, y_pred)
200
201 self._sum += ssim_metric.item() * y.shape[0]
202 # we multiply because ssim calculate mean of each image in batch
203 # we multiply so we will divide correctly
204
205 self._num_examples += y.shape[0]
206
207 def compute(self):
208 if self._num_examples == 0:
209 raise NotComputableError('CrowdCountingMeanSSIM must have at least one example before it can be computed.')
210 return self._sum / self._num_examples
211
212
213 class CrowdCountingMeanPSNRclamp(Metric):
214 """
215 Calculates ssim
216 require package https://github.com/photosynthesis-team/piq
217 - `update` must receive output of the form `(y_pred, y)`.
218 """
219 def reset(self):
220 self._sum = 0.0
221 self._num_examples = 0
222
223 def update(self, output):
224 y_pred = output[0]
225 y_pred = torch.clamp_min(y_pred, min=0.0)
226 y = output[1]
227 y = torch.clamp_min(y, min=0.0)
228
229 psnr_metric = piq.psnr(y, y_pred)
230
231 self._sum += psnr_metric.item() * y.shape[0]
232 # we multiply because ssim calculate mean of each image in batch
233 # we multiply so we will divide correctly
234
235 self._num_examples += y.shape[0]
236
237 def compute(self):
238 if self._num_examples == 0:
239 raise NotComputableError('CrowdCountingMeanPSNR must have at least one example before it can be computed.')
240 return self._sum / self._num_examples
File experiment_main.py changed (mode: 100644) (index 5210431..10aac00)
... ... from data_flow import get_dataloader, create_image_list
5 5 from ignite.engine import Events, create_supervised_trainer, create_supervised_evaluator from ignite.engine import Events, create_supervised_trainer, create_supervised_evaluator
6 6 from ignite.metrics import Loss from ignite.metrics import Loss
7 7 from ignite.handlers import Checkpoint, DiskSaver, Timer from ignite.handlers import Checkpoint, DiskSaver, Timer
8 from crowd_counting_error_metrics import CrowdCountingMeanAbsoluteError, CrowdCountingMeanSquaredError, CrowdCountingMeanAbsoluteErrorWithCount, CrowdCountingMeanSquaredErrorWithCount, CrowdCountingMeanSSIM, CrowdCountingMeanPSNR
8 from crowd_counting_error_metrics import CrowdCountingMeanAbsoluteError, CrowdCountingMeanSquaredError,\
9 CrowdCountingMeanAbsoluteErrorWithCount, CrowdCountingMeanSquaredErrorWithCount,\
10 CrowdCountingMeanSSIMabs, CrowdCountingMeanPSNRabs, \
11 CrowdCountingMeanSSIMclamp, CrowdCountingMeanPSNRclamp
12
9 13 from visualize_util import get_readable_time from visualize_util import get_readable_time
10 14 from mse_l1_loss import MSEL1Loss, MSE4L1Loss from mse_l1_loss import MSEL1Loss, MSE4L1Loss
11 15 import torch import torch
 
... ... if __name__ == "__main__":
228 232 if args.eval_density: if args.eval_density:
229 233 evaluator_test = create_supervised_evaluator(model, evaluator_test = create_supervised_evaluator(model,
230 234 metrics={ metrics={
231 'ssim': CrowdCountingMeanSSIM(),
232 'psnr': CrowdCountingMeanPSNR(),
235 'ssimabs': CrowdCountingMeanSSIMabs(),
236 'psnrabs': CrowdCountingMeanPSNRabs(),
237 'ssimclamp': CrowdCountingMeanSSIMclamp(),
238 'psnrclamp': CrowdCountingMeanPSNRclamp(),
233 239 }, device=device) }, device=device)
234 240 else: else:
235 241 evaluator_test = create_supervised_evaluator(model, evaluator_test = create_supervised_evaluator(model,
 
... ... if __name__ == "__main__":
371 377 timestamp = get_readable_time() timestamp = get_readable_time()
372 378
373 379 if args.eval_density: if args.eval_density:
374 print(timestamp + " Test set Results - Avg ssim: {:.2f} Avg psnr: {:.2f} Avg loss: {:.2f}"
375 .format(test_metrics['ssim'], test_metrics['psnr'], 0))
376 experiment.log_metric("test_ssim", test_metrics['ssim'])
377 experiment.log_metric("test_psnr", test_metrics['psnr'])
380 print(timestamp + " Test set Results ABS - Avg ssim: {:.2f} Avg psnr: {:.2f} Avg loss: {:.2f}"
381 .format(test_metrics['ssimabs'], test_metrics['psnrabs'], 0))
382 experiment.log_metric("test_ssim abs", test_metrics['ssimabs'])
383 experiment.log_metric("test_psnr abs", test_metrics['psnrabs'])
384
385 print(timestamp + " Test set Results CLAMP - Avg ssim: {:.2f} Avg psnr: {:.2f} Avg loss: {:.2f}"
386 .format(test_metrics['ssimclamp'], test_metrics['psnrclamp'], 0))
387 experiment.log_metric("test_ssim clamp", test_metrics['ssimclamp'])
388 experiment.log_metric("test_psnr clamp", test_metrics['psnrclamp'])
378 389 else: else:
379 390 print(timestamp + " Test set Results - Avg mae: {:.2f} Avg mse: {:.2f} Avg loss: {:.2f}" print(timestamp + " Test set Results - Avg mae: {:.2f} Avg mse: {:.2f} Avg loss: {:.2f}"
380 391 .format( test_metrics['mae'], test_metrics['mse'], 0)) .format( test_metrics['mae'], test_metrics['mse'], 0))
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/hahattpro/crowd_counting_framework

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/hahattpro/crowd_counting_framework

Clone this repository using git:
git clone git://git.rocketgit.com/user/hahattpro/crowd_counting_framework

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main