- 음식 이미지 인식 후, 음식의 칼로리 추정
- 일일이 음식의 종류와 양을 기입하는 불편함 없이, 사진 한장으로 칼로리 계산 가능.
- 부피를 계산하여 칼로리를 계산하기 때문에 보다 정확함.
- Input Img → Food Detection → Volume Estimation → Calorie Calculation → Results
- 3개의 Convolution layer와 Pooling layer로 구성
- Keras를 통한 이미지 로드 및 전처리 방법 : image.ImageDataGenerator
- atch_size는 150, epochs는 100으로 설정
- 결과 Loss: 108.18%, ACC : 73.42%가 나옴
3-3. Calorie Estimation
- Food 101 데이터 셋의 음식 종류와 g수에 따른 칼로리, 영양성분을 나타내기 위해 dict = {'food' : [g, kcal, 탄수화물, 단백질, 지방, 당류]} 형태의 딕셔너리 생성
- (추정한 volume / g) * kcal 로 input image의 최종 칼로리 계산
- requirements.txt 설치
pip install -r requirements.txt
- food dataset 다운로드 후 ./Food_Detection/ 에 압축 풀기
- CNN Model 다운로드 후 ./Food_Detection/ 에 압축 풀기
4-2 volume_estimator.py 파일 실행.
- food_detection, volume estimation, calorie calculation이 한번에 실행되도록 구현
python volume_estimator.py --input_images ../Food_Detection/Myfood/images/test_set/kimbap/Img_069_0755.jpg --depth_model_architecture depth_architecture.json --depth_model_weights depth_weights.h5 --segmentation_weights segmentation_weights.h5
- --input_images : input image 경로
- depth_model_architecture, depth_model_weights, segmentation_weights는 여기에서 다운로드 후 ./Food_volume_estimation/ 에 넣기
- --plot_results : depth와 object mask, plate contour을 그림으로 나타냄
- --plate_diameter_prior : 접시 지름
- 음식 종류와 g수에 따른 칼로리, 영양성분 나타남.