TCM image recognition system (APP + server)

TCM image recognition system (APP + server)

2022-09-05 0 957
Resource Number 38086 Last Updated 2025-02-24
¥ 0HKD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

What is recommended in this issue is the traditional Chinese medicine image recognition system.

TCM image recognition system (APP + server)插图

Item Description

Traditional Chinese medicine recognition system mainly adopts the method of photo uploading on the APP side, and constructs convolutional neural network (CNN) to recognize images, which has the characteristics of high recognition efficiency and accuracy. The functions of the APP include but are not limited to photo recognition, Chinese medicine question and answer (paid consultation), search and query, Chinese medicine properties and efficacy review, prescription intelligent recommendation [under development], etc. This system includes APP side and server side.

Project Introduction

This project consists of six modules:

  • medicine-app: APP
  • medicine-server: Server
  • medicine-crawler: Crawler engineering
  • medicine-model: Convolutional neural network
  • medicine-util: Utility class
  • medicine-dataset: dataset

Technical Introduction

medicine-app

Flutter development

medicine-server Server engineering

Gradle build +SpringBoot framework

One-click launch and deployment document database: MongoDB Full-text search: Elasticsearch + IK Word classifier database

MySQL deep Learning runtime architecture: ONNX Runtime (ONNX Runtime is a cross-platform inference and training machine-learning accelerator)

medicine-crawler

Crawler is mainly used to climb the training set and the detailed information of Chinese medicine , including but not limited to: Chinese medicine name, Chinese medicine form, picture, alias, English name, matching prescription, efficacy and function, clinical application, origin distribution, medicinal parts, sex and taste return to the meridian, pharmacological research, main ingredients, use conscription, harvesting and processing, medicinal material properties and other information.

data structure

  • Primary Classification Information of Chinese medicine

TCM image recognition system (APP + server)插图1

  • Chinese Medicine details

TCM image recognition system (APP + server)插图2

medicine-model Convolutional Neural network engineering

  • Language: Python
  • Using TensorFlow deep learning framework, using Keras will significantly reduce the amount of code

Xception function definition:

def Xception(include_top=True,
    weights='imagenet',
    input_tensor=None,
    input_shape=None,
    pooling=None,
    classes=1000,
    **kwargs)

# Parameter 
# include_top: Whether to keep the top-level fully connected network 
# weights: None means random initialization, i.e. no pre-trained weights are loaded. 'imagenet 'stands for load pretraining weight 
# input_tensor: Keras tensor can be filled in as the image input of the model tensor
# input_shape: Optional, valid only if include_top=False, should be a tuple of length 3, indicating the shape of the input image, the image width and height must be greater than 71, such as (150,150,3)
# pooling: specifies pooling when include_top=False. None means no pooling, and the output of the last convolution layer is a 4D tensor. 'avg' stands for global average pooling and 'max' for global maximum pooling. 
# classes: Optional, number of categories for picture classification, available only if include_top=True and no pre-training weights are loaded 

Build code

Set Xception parameters

Transfer learning parameter weights loading: xception_weights

# Set the width and height of the input image and the number of channels 
img_size = (299, 299, 3)

base_model = keras.applications.xception.Xception(include_top=False,
                                                weights='..\\resources\\keras-model\\xception_weights_tf_dim_ordering_tf_kernels_notop.h5',
                                                input_shape=img_size,
                                                pooling='avg')
  
# Full connection layer, using softmax activation function to calculate probability value, classification size is 628
model = keras.layers.Dense(628, activation='softmax',  name='predictions')(base_model.output)
model = keras.Model(base_model.input, model)

# Lock convolution layer 
for layer in base_model.layers:
  layer.trainable = False

Full connection layer training (v1.0)

from base_model import model

# Set training set image size and directory parameters 
img_size = (299, 299)
dataset_dir = '.. \\dataset\\dataset'
img_save_to_dir = 'resources\\image-traing\\'
log_dir = 'resources\\train-log'

model_dir = ‘resources\\keras-model\\’

# Use data enhancement

train_datagen = keras.preprocessing.image.ImageDataGenerator(
rescale=1. / 255,
shear_range=0.2,
width_shift_range=0.4,
height_shift_range=0.4,
rotation_range=90,
zoom_range=0.7,
horizontal_flip=True,
vertical_flip=True,
preprocessing_function=keras.applications.xception.preprocess_input)

test_datagen = keras.preprocessing.image.ImageDataGenerator(
preprocessing_function=keras.applications.xception.preprocess_input)

train_generator = train_datagen.flow_from_directory(
dataset_dir,
save_to_dir=img_save_to_dir,
target_size=img_size,
class_mode=‘categorical’)

validation_generator = test_datagen.flow_from_directory(
dataset_dir,
save_to_dir=img_save_to_dir,
target_size=img_size,
class_mode=‘categorical’)

# Early stop method and dynamic learning rate setting

early_stop = EarlyStopping(monitor=’val_loss’, patience=13)
reduce_lr = ReduceLROnPlateau(monitor=’val_loss’, patience=7, mode=’auto’, factor=0.2)
tensorboard = keras.callbacks.tensorboard_v2.TensorBoard(log_dir=log_dir)

for layer in model.layers:
layer.trainable = False

# Model compilation

model.compile(optimizer=‘rmsprop’, loss=’categorical_crossentropy’, metrics=[‘accuracy’])

history = model.fit_generator(train_generator,
steps_per_epoch=train_generator.samples // train_generator.batch_size,
epochs=100,
validation_data=validation_generator,
validation_steps=validation_generator.samples // validation_generator.batch_size,
callbacks=[early_stop, reduce_lr, tensorboard])
# Model export
model.save(model_dir + ‘chinese_medicine_model_v1. 0. H5) < / span > < / code > < / pre >

Description of Dependent environment

Dependency

Version

JDK

11+

Python

3.6

Gradle

6.5

TensorFlow

2.0

MongoDB

4.2.2

MySQL

8.0+

Spring Boot

2.2.2

Elasticsearch

7.4.2

IK word segmentation

7.4.2

ONNX Runtime

1.8.1


资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free Source Code TCM image recognition system (APP + server) https://ictcoder.com/tcm-image-recognition-system-app-server/

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. ICTcoder will then settle the payment for the seller. Note: Please ensure to place your order and make payment through ICTcoder. If you do not place your order and make payment through ICTcoder, and the seller sends fake source code or encounters any issues, ICTcoder will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by ICTcoder until 7 days after the transaction is completed and both parties confirm that there are no issues. ICTcoder will then settle with the seller. In case of any disputes, ICTcoder will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through ICTcoder, any issues and disputes have nothing to do with ICTcoder, and ICTcoder will not be responsible for any liabilities!
View details
  • 1. ICTcoder will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. ICTcoder cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact ICTcoder for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that ICTcoder can intervene quickly.
View details
  • 1. As a third-party intermediary platform, ICTcoder solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the ICTcoder platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

ICTcoder Customer Service

24-hour online professional services