/visualize_util.py (1b0f845587f0f37166d44fa0c74b51f89cf8b349) (1146 bytes) (mode 100644) (type blob)
import glob
import PIL.Image as Image
from matplotlib import pyplot as plt
from matplotlib import cm as CM
import os
import numpy as np
import time
from PIL import Image
def save_density_map(density_map, name):
plt.figure(dpi=600)
plt.axis('off')
plt.margins(0, 0)
plt.imshow(density_map, cmap=CM.jet)
plt.savefig(name, dpi=600, bbox_inches='tight', pad_inches=0)
plt.close()
def save_density_map_with_colorrange(density_map, name, vmin, vmax):
plt.figure(dpi=600)
plt.axis('off')
plt.margins(0, 0)
plt.imshow(density_map, cmap=CM.jet)
plt.clim(vmin, vmax)
plt.savefig(name, dpi=600, bbox_inches='tight', pad_inches=0)
plt.close()
def save_img(imgnp, name):
# plt.imshow(imgnp[0].permute(1, 2, 0).numpy())
plt.imsave(name, imgnp[0].permute(1, 2, 0).numpy())
# plt.show()
# im = Image.fromarray(imgnp[0].permute(1, 2, 0).numpy())
# im.save(name)
def get_readable_time():
"""
make human readable time with format year-month-day hour-minute
:return: a string of human readable time (ex: '2020-02-24 10:31' )
"""
return time.strftime('%Y-%m-%d %H:%M')
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