<jupyter_start><jupyter_text>Crowd-Counting using Multi-Column Convolutional Neural Networks.Publication: <NAME>., <NAME>., <NAME>., <NAME>., & <NAME>. (2016). Single-image crowd counting via multi-column convolutional neural network. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 589-597).<jupyter_code>from network import MCNN
import cv2
from matplotlib import pyplot as plt
dataset='A' # A or B 
mcnn = MCNN(dataset)<jupyter_output>WARNING:tensorflow:From C:\Users\sohai\AppData\Local\conda\conda\envs\deep\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.<jupyter_text>Test on single image<jupyter_code># image path
img_path = '.\\data\\original\\shanghaitech\\part_'+ dataset +'_final\\test_data\\images\\IMG_11.jpg'
img_path = '7.jpg'

# For predicting the count of people in one Image.
numoppl, den_sum = mcnn.predict(img_path)
print('Predicted: ', int(numoppl))
print('Ground Truth: ', den_sum)


img = cv2.imread(img_path)
cv2.putText(img, 'Prediction : ' + str(int(numoppl)), (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)
cv2.putText(img, 'Ground Tth : ' + str(den_sum), (10, 70), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 0), 2)
img = img[:,:,::-1]
plt.imshow(img)
plt.show()<jupyter_output><empty_output><jupyter_text>Evaluation on a dataset<jupyter_code>mcnn.test()<jupyter_output>WARNING:tensorflow:From C:\Users\sohai\AppData\Local\conda\conda\envs\deep\lib\site-packages\tensorflow\python\training\saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
INFO:tensorflow:Restoring parameters from modelA/model.ckpt
loading test data from dataset A ...
50 / 182
100 / 182
150 / 182
loading test data from dataset A finished
Evaluating...
Accuracy:  75.3654509084816
mae:  149.86965705536224
mse:  233.41499676148027
{'fraction_non_alphanumeric': 0.1213953488372093, 'fraction_numerical': 0.05441860465116279, 'mean_word_length': 5.764150943396227, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '7868', 'license': 'MIT', 'n_tokens_mistral': 839, 'n_tokens_neox': 739, 'n_words': 191, 'path': 'test.ipynb', 'repo_name': 'numediart/Crowd-Counting-with-MCNNs', 'size': '2153'}