From 7807470c573ff3321d10896c527403fac1e93739 Mon Sep 17 00:00:00 2001 From: Pei-Yun Sun Date: Tue, 20 Oct 2020 12:43:29 +1100 Subject: [PATCH] fixing statistical results --- .DS_Store | Bin 10244 -> 10244 bytes src/__pycache__/config.cpython-38.pyc | Bin 948 -> 948 bytes .../general_controller.cpython-38.pyc | Bin 6207 -> 5503 bytes .../prediction_controller.cpython-38.pyc | Bin 1955 -> 2074 bytes src/controller/general_controller.py | 127 +++++++++--------- src/controller/prediction_controller.py | 16 +-- .../__pycache__/constants.cpython-38.pyc | Bin 744 -> 681 bytes src/extension/constants.py | 117 +++++++--------- .../__pycache__/feedback.cpython-38.pyc | Bin 838 -> 897 bytes src/models/feedback.py | 7 +- src/templates/homePage.html | 14 +- src/templates/statisticalPage.html | 71 +++++----- 12 files changed, 175 insertions(+), 177 deletions(-) diff --git a/.DS_Store b/.DS_Store index b94b956d9c2f87ddde3af72ba6dfbfe3260d9574..a4fab54b683477cc80b4807faeee4fdb07fad17f 100644 GIT binary patch delta 206 zcmZn(XbIS$Di9}=^p=5vfrUYjA)O(Up(Hoo#U&{xKM5$tAttdk|M|Q_j;Qh}c;yQ+ z41<&Na|?ia7??~9Ha82bV`Mx%*+{5?TdKO+(AdOKN5R-=@*W|1#@Una0LeL%{|HGi z70uc#CTz~CtmkW6`V3+vGea>$5kqorKEgtf?Eb98u*{@X8lt z7zQWj=N16dxhi~XHC8fBxg_lD<2dYN>s6LW>fghvYAPgnHc~- Ckvc>G diff --git a/src/__pycache__/config.cpython-38.pyc b/src/__pycache__/config.cpython-38.pyc index de6c9380c7d81007a7e6b98548ad919a478d76cb..9cd495276fd5b236a93e156a75a745571dbdeff2 100644 GIT binary patch delta 20 acmdnOzJ;ATl$V!_0SH#<_HE=|$qWE5{shPX delta 20 acmdnOzJ;ATl$V!_0SMBj^={-|$qWE6lLYJl diff --git a/src/controller/__pycache__/general_controller.cpython-38.pyc b/src/controller/__pycache__/general_controller.cpython-38.pyc index f13adf3946a3fd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wc_vkk4HaH@)&rKzY5z-n?a|&s6e{X8>^xPa z$mJ*hn%sc@`BwS9xZGdb&sV0R&L)cxwMd>d;S3ncjV2`Gcd0Md0>rujYO2YS2a*H>= x9U_nu8 zN@j9NW`15!YH?{!NpX}&QDS)jy67#Il*E$MmnVRhYKl*u%(77I76(YABr`Yl7IR*H zc@YapN@TJ%>r#;@zP!}(c!bF-8H%hYKVc0M2?DBNVB=u~K@LVPMlmKn=E;6+ro0?1 zj7&ht@t1>@gK2ULo3p4bP-T%dDq%DE4x6TgGEndqbAYE$5i>|y4MZ3KiOEXr7K)A_ UN!FtL(vs97ZjcOy5!LJ(02>KbTmS$7 delta 226 zcmbOwu$Z4Wl$V!_0SK}e_QpqSu4Nr=6 zGgB~wrp)HQOzRohU!DM}(G;Ehgk>Rn5etYdJb5B@mc^{i8qrfC~XHhGlWRV3bVL3U1T~k&GD0quGz|*IQ86>R=;&P-UmZX+s e=B7@b$!?)&2NGf}$}cTRE#d~L!7%3&y9NNeVlc%3 diff --git a/src/controller/general_controller.py b/src/controller/general_controller.py index 1fbee31..eade06b 100644 --- a/src/controller/general_controller.py +++ b/src/controller/general_controller.py @@ -5,6 +5,7 @@ import re from flask_restplus import Namespace, Resource import datetime import copy +import math api = Namespace('general', path='/', description='general information related to app') @@ -19,10 +20,10 @@ class AppInfo(Resource): """ app_info = { 'developedBy': 'This app was developed by the Melbourne eResearch Group (www.eresearch.unimelb.edu.au) within the School of Computing and Information Systems (https://cis.unimelb.edu.au) at The University of Melbourne (www.unimelb.edu.au). ', - 'description': 'The app uses artificial intelligence (convolutional neural networks) that have been trained on dog/cat images to identify whether a dog/cat is in an image, and if so the species type (breed) and it\'s emotion.', + 'description': 'The app uses artificial intelligence (convolutional neural networks) to identify the age, gender, and emotion of the people.', 'contact': 'https://eresearch.unimelb.edu.au', 'developedByHTML': '

This app was developed by the Melbourne eResearch Group (www.eresearch.unimelb.edu.au) within the School of Computing and Information Systems (https://cis.unimelb.edu.au) at The University of Melbourne (www.unimelb.edu.au).

', - 'descriptionHTML': '

The app uses artificial intelligence (convolutional neural networks) that have been trained on dog/cat images to identify whether a dog/cat is in an image, and if so the species type (breed) and it\'s emotion.

', + 'descriptionHTML': '

The app uses artificial intelligence (convolutional neural networks) to identify the age, gender, and emotion of the people.

', 'contactHTML': '

Please contact us at: eresearch.unimelb.edu.au

' } @@ -41,33 +42,19 @@ class StatisticalData(Resource): from models.prediction import Prediction from models.feedback import Feedback - total_cat_breed = [] - total_dog_breed = [] prediction_collection = Prediction._get_collection() feedback_collection = Feedback._get_collection() statistical_data = copy.deepcopy(CONSTANTS['STATISTICAL_DATA']) - # initial statistical_data based on breed and alpha order - f = open("model_data/pet_classes.txt", "r") - for each_line in f: - first_char = each_line[0] - if first_char.isupper(): - total_cat_breed.append(re.sub(r"_", " ", each_line.rstrip(), flags=re.IGNORECASE).title()) - else: - total_dog_breed.append(re.sub(r"_", " ", each_line.rstrip(), flags=re.IGNORECASE).title()) - f.close() - total_cat_breed.sort() - total_dog_breed.sort() + # initial statistical_data based on age and ascending order + total_age = [] + for i in range(21): + total_age.append(str(i * 5) + '+') - for each_breed in total_cat_breed: - statistical_data['Cat']['prediction_data']['breed'][each_breed] = 0 - statistical_data['Cat']['feedback_data']['breed']['wrong'][each_breed] = 0 - statistical_data['Cat']['feedback_data']['breed']['correct'][each_breed] = 0 - - for each_breed in total_dog_breed: - statistical_data['Dog']['prediction_data']['breed'][each_breed] = 0 - statistical_data['Dog']['feedback_data']['breed']['wrong'][each_breed] = 0 - statistical_data['Dog']['feedback_data']['breed']['correct'][each_breed] = 0 + for each_age in total_age: + statistical_data['prediction_data']['age'][each_age] = 0 + statistical_data['feedback_data']['age']['wrong'][each_age] = 0 + statistical_data['feedback_data']['age']['correct'][each_age] = 0 # photo by date today = datetime.datetime.today().replace(hour=0, minute=0, second=0, microsecond=0) @@ -90,65 +77,85 @@ class StatisticalData(Resource): # prediction total_prediction = prediction_collection.find({}) + for each_prediction in total_prediction: prediction_results = each_prediction['predictionResults'] for each_result in prediction_results: - statistical_data[each_result['type']]['prediction_number'] = statistical_data[each_result['type']].get( + statistical_data['prediction_number'] = statistical_data.get( 'prediction_number', 0) + 1 - statistical_data[each_result['type']]['prediction_data']['breed'][each_result['breed']] = \ - statistical_data[each_result['type']]['prediction_data']['breed'].get(each_result['breed'], 0) + 1 - statistical_data[each_result['type']]['prediction_data']['emotion'][each_result['emotion']] = \ - statistical_data[each_result['type']]['prediction_data']['emotion'].get(each_result['emotion'], - 0) + 1 + + # age, gender, emotion + each_age = str(5*math.floor(each_result['age'] / 5)) + '+' + + statistical_data['prediction_data']['age'][each_age] = \ + statistical_data['prediction_data']['age'].get(each_age, 0) + 1 + statistical_data['prediction_data']['gender'][each_result['gender']] = \ + statistical_data['prediction_data']['gender'].get(each_result['gender'], 0) + 1 + statistical_data['prediction_data']['emotion'][each_result['emotion']] = \ + statistical_data['prediction_data']['emotion'].get(each_result['emotion'], 0) + 1 + # feedback total_feedback = feedback_collection.find({}) for each_feedback in total_feedback: feedback_content = each_feedback['content'] for each_content in feedback_content: - statistical_data[each_content['type']]['feedback_number'] = statistical_data[each_content['type']].get( + statistical_data['feedback_number'] = statistical_data.get( 'feedback_number', 0) + 1 - if not each_content['breedCorrectness']: - statistical_data[each_content['type']]['feedback_data']['breed']['wrong'][ - each_content['breedFeedback']] = \ - statistical_data[each_content['type']]['feedback_data']['breed'][ - 'wrong'].get(each_content['breedFeedback'], 0) + 1 + # age + if not each_content['ageCorrectness']: + statistical_data['feedback_data']['age']['wrong'][ + each_content['ageFeedback']] = \ + statistical_data['feedback_data']['age'][ + 'wrong'].get(each_content['ageFeedback'], 0) + 1 else: - statistical_data[each_content['type']]['feedback_data']['breed']['correct'][ - each_content['breedFeedback']] = \ - statistical_data[each_content['type']]['feedback_data']['breed']['correct'].get( - each_content['breedFeedback'], 0) + 1 + statistical_data['feedback_data']['age']['correct'][ + each_content['ageFeedback']] = \ + statistical_data['feedback_data']['age']['correct'].get( + each_content['ageFeedback'], 0) + 1 + + # gender + if not each_content['genderCorrectness']: + statistical_data['feedback_data']['gender']['wrong'][ + each_content['genderFeedback']] = \ + statistical_data['feedback_data']['gender'][ + 'wrong'].get(each_content['genderFeedback'], 0) + 1 + else: + statistical_data['feedback_data']['gender']['correct'][ + each_content['genderFeedback']] = \ + statistical_data['feedback_data']['gender']['correct'].get( + each_content['genderFeedback'], 0) + 1 if not each_content['emotionCorrectness']: - statistical_data[each_content['type']]['feedback_data']['emotion']['wrong'][ + statistical_data['feedback_data']['emotion']['wrong'][ each_content['emotionFeedback']] = \ - statistical_data[each_content['type']]['feedback_data']['emotion']['wrong'].get( + statistical_data['feedback_data']['emotion']['wrong'].get( each_content['emotionFeedback'], 0) + 1 else: - statistical_data[each_content['type']]['feedback_data']['emotion']['correct'][ + statistical_data['feedback_data']['emotion']['correct'][ each_content['emotionFeedback']] = \ - statistical_data[each_content['type']]['feedback_data']['emotion']['correct'].get( + statistical_data['feedback_data']['emotion']['correct'].get( each_content['emotionFeedback'], 0) + 1 result = { 'totalNumberOfPhotoUploaded': prediction_collection.count_documents({}), - 'totalNumberOfCatPrediction': statistical_data['Cat']['prediction_number'], - 'totalNumberOfDogPrediction': statistical_data['Dog']['prediction_number'], - 'totalNumberOfCatFeedback': statistical_data['Cat']['feedback_number'], - 'totalNumberOfDogFeedback': statistical_data['Dog']['feedback_number'], - 'totalNumberOfDogBreedPrediction': statistical_data['Dog']['prediction_data']['breed'], - 'totalNumberOfDogBreedCorrectFeedback': statistical_data['Dog']['feedback_data']['breed']['correct'], - 'totalNumberOfDogBreedWrongFeedback': statistical_data['Dog']['feedback_data']['breed']['wrong'], - 'totalNumberOfDogEmotionPrediction': statistical_data['Dog']['prediction_data']['emotion'], - 'totalNumberOfDogEmotionCorrectFeedback': statistical_data['Dog']['feedback_data']['emotion']['correct'], - 'totalNumberOfDogEmotionWrongFeedback': statistical_data['Dog']['feedback_data']['emotion']['wrong'], - 'totalNumberOfCatBreedPrediction': statistical_data['Cat']['prediction_data']['breed'], - 'totalNumberOfCatBreedCorrectFeedback': statistical_data['Cat']['feedback_data']['breed']['correct'], - 'totalNumberOfCatBreedWrongFeedback': statistical_data['Cat']['feedback_data']['breed']['wrong'], - 'totalNumberOfCatEmotionPrediction': statistical_data['Cat']['prediction_data']['emotion'], - 'totalNumberOfCatEmotionCorrectFeedback': statistical_data['Cat']['feedback_data']['emotion']['correct'], - 'totalNumberOfCatEmotionWrongFeedback': statistical_data['Cat']['feedback_data']['emotion']['wrong'], + + 'totalNumberOfPrediction': statistical_data['prediction_number'], + 'totalNumberOfFeedback': statistical_data['feedback_number'], + + 'totalNumberOfAgePrediction': statistical_data['prediction_data']['age'], + 'totalNumberOfAgeCorrectFeedback': statistical_data['feedback_data']['age']['correct'], + 'totalNumberOfAgeWrongFeedback': statistical_data['feedback_data']['age']['wrong'], + + 'totalNumberOfGenderPrediction': statistical_data['prediction_data']['gender'], + 'totalNumberOfGenderCorrectFeedback': statistical_data['feedback_data']['gender']['correct'], + 'totalNumberOfGenderdWrongFeedback': statistical_data['feedback_data']['gender']['wrong'], + + 'totalNumberOfEmotionPrediction': statistical_data['prediction_data']['emotion'], + 'totalNumberOfEmotionCorrectFeedback': statistical_data['feedback_data']['emotion']['correct'], + 'totalNumberOfEmotionWrongFeedback': statistical_data['feedback_data']['emotion']['wrong'], + 'numberOfPhotoByDate': total_number_of_photo_within_one_week } diff --git a/src/controller/prediction_controller.py b/src/controller/prediction_controller.py index ac522f5..c4d360a 100644 --- a/src/controller/prediction_controller.py +++ b/src/controller/prediction_controller.py @@ -27,7 +27,6 @@ class Prediction(Resource): img, detections = deepface.analyze(image) - # TODO: handle outputs # encode image and jsonify detections buffered = io.BytesIO() img.save(buffered, format="JPEG") @@ -61,13 +60,12 @@ class Prediction(Resource): 'emotionScore': emotion_score }) - # store to db? - - # new_prediction = Prediction(**{ - # 'predictionResults': formatted_prediction_results, - # 'rawPredictionResults': detections, - # 'date': datetime.datetime.now(), - # }) - # new_prediction.save() + # store results to db + new_prediction = Prediction(**{ + 'predictionResults': formatted_prediction_results, + 'rawPredictionResults': detections, + 'date': datetime.datetime.now(), + }) + new_prediction.save() return send_json_response(result, 200) diff --git a/src/extension/__pycache__/constants.cpython-38.pyc b/src/extension/__pycache__/constants.cpython-38.pyc index 9927c170367bbe54d8bc8585b9bd6d5108191784..4568404b2040ad78d0ff9985673f9935c6060390 100644 GIT binary patch literal 681 zcmZ9I&u-H|5XRT*bv6xzl-~OQzTh(wAgs2~NYpvl6;dS>HlB&GXx7%QEy#^0;0gQ! zywYAdap2l2RaLRuD1XF^{H^Dk`C03^91aJ>#;4amr}qINzg@8(BU`++kN#l=2zWrj z2L=K3fOj1F&@YKoIOyo(>E72lu>B{UUlKdo}o;d!ML=1s`VXpRUok$;`ab}_Tl&ufKH<__3cqdf~mBg}9MxiX|z{On?q zjVFmYOtUx}r`h-<{xCg_vp5Mob8s?Ate<4*FQSg!HJ#kOj4m}Q9o1MaTdAY>Wpm!n zB0#L?BF9LpJi_k{N^S2F<(1Tpkd1y}7u|ogsGz;ZH*N>|vlZ&?<%$h#<-(&6EZFOK abj9x2(bj)pz5lw7+~tbhuv_+*-TVVqVY}4; literal 744 zcmb`D&uZI15XRTi%94^ePNA>RgD%y%P)da@Vu2%@N`gigBWpHB)Rx5ViYB+bK;A$v z&}$xNbL^?-9$Fd*oux_YbLlMlwBK+3uuL`@9T1G`o10bU67p4>{WwPR9zSu50t5yd z0}L>Mf(1jcdkY+JDx&rAxX2EAqasKTd*hiqpfgWZf1J)^Egbb!Xa38a5zagA&78nE zA>N5H%R=TRG#h2jinhH{cFa1-i>RYWMDYw|tvO?$Y_@A;)zq4N z=1sj(cG+;wO6gHGzQB@oQGQz0-EPgedeL$QRjC`E(0C6)AqzEnZqgR#nv+5*bJ}b? zGd~RC=q#A8((`4Q+u_+FjTW&wNzx#Vk~ErNY8s?L>!zux$n zU|jeutFF3Q_@|Yeb!#6OYcGnD`GS`|yOgXJ_(;EOY9WhSir2Vd=k2b6Zp+^3wTNq! np1E zS_D@u2;onTU^HeE0$N=pG
  • ID: ${response['results'][i].id}` - const emotionList = `
    • ${response['results'][i].emotion['all'][0]}
    • ${response['results'][i].emotion['all'][1]}
    • ${response['results'][i].emotion['all'][2]}
    • ${response['results'][i].emotion['all'][3]}
    • ${response['results'][i].emotion['all'][4]}
    • ${response['results'][i].emotion['all'][5]}
    • ${response['results'][i].emotion['all'][6]}
    ` - const otherInfo = `
  • Age: ${response['results'][i].age}
  • Gender: ${response['results'][i].gender}
  • Emotion: ${response['results'][i].emotion['dominant']}
${emotionList}` + const addedId = `
  • ID: ${response['results'][i].id}
  • ` + const emotionList = `
    • ${response['results'][i].emotion['all'][0]}
    • +
    • ${response['results'][i].emotion['all'][1]}
    • +
    • ${response['results'][i].emotion['all'][2]}
    • +
    • ${response['results'][i].emotion['all'][3]}
    • +
    • ${response['results'][i].emotion['all'][4]}
    • +
    • ${response['results'][i].emotion['all'][5]}
    • +
    • ${response['results'][i].emotion['all'][6]}
    ` + const otherInfo = `
  • Age: ${response['results'][i].age}
  • +
  • Gender: ${response['results'][i].gender}
  • +
  • Emotion: ${response['results'][i].emotion['dominant']}
${emotionList}
` const addedHtml = response['isShowId'] !== 'false' ? addedId + otherInfo : otherInfo resultArea.innerHTML += addedHtml } diff --git a/src/templates/statisticalPage.html b/src/templates/statisticalPage.html index 2d58a46..d992a8e 100644 --- a/src/templates/statisticalPage.html +++ b/src/templates/statisticalPage.html @@ -16,25 +16,25 @@
-

Cat:

+

Age:

- +

- +

-

Dog:

+

Gender:

- +

- +

@@ -42,7 +42,7 @@
-
+ +
+
+
+