feat: implement backend image classification with TensorFlow.js model
- Extend shared types for image classification, including PredictionProbability, UploaderMetadata, and ImageClassificationRecord. - Create image_classifications table in the database with necessary fields and foreign key constraints. - Implement disease mappers to convert database rows to shared disease records. - Develop uploader client to handle image uploads to external service. - Create image model service to load and classify images using TensorFlow.js. - Add API routes for image classification, including GET for history and POST for new classifications. - Implement frontend components for image classification form and display results. - Update dashboard to integrate image classification functionality and display results. - Document implementation plan for backend image classification.
This commit is contained in:
@@ -15,6 +15,40 @@ export type ManualClassificationRecord = {
|
||||
disease: DiseaseCatalogItem;
|
||||
};
|
||||
|
||||
export type PredictionProbability = {
|
||||
diseaseSlug: DiseaseSlug;
|
||||
label: DiseaseCatalogItem['label'];
|
||||
confidence: number;
|
||||
};
|
||||
|
||||
export type UploaderMetadata = {
|
||||
public_id: string;
|
||||
file_name: string;
|
||||
mime_type: string;
|
||||
size_bytes: number;
|
||||
file_type: string;
|
||||
uploader_id?: number;
|
||||
created_at: string;
|
||||
telegram_file_id?: string;
|
||||
telegram_file_unique_id?: string;
|
||||
storage_chat_id?: number;
|
||||
storage_message_id?: number;
|
||||
download_url: string;
|
||||
};
|
||||
|
||||
export type ImageClassificationRecord = {
|
||||
id: string;
|
||||
predictedDiseaseSlug: DiseaseSlug;
|
||||
confidence: number;
|
||||
probabilities: PredictionProbability[];
|
||||
imageUrl: string;
|
||||
originalFileName: string;
|
||||
uploaderPublicId: string;
|
||||
uploader: UploaderMetadata;
|
||||
createdAt: string;
|
||||
disease: DiseaseCatalogItem;
|
||||
};
|
||||
|
||||
export type DashboardSummary = {
|
||||
diseaseCount: number;
|
||||
classificationCount: number;
|
||||
|
||||
@@ -20,4 +20,7 @@ export type {
|
||||
ManualClassificationRequest,
|
||||
ManualClassificationRecord,
|
||||
DashboardSummary,
|
||||
PredictionProbability,
|
||||
UploaderMetadata,
|
||||
ImageClassificationRecord,
|
||||
} from './classifications';
|
||||
|
||||
Reference in New Issue
Block a user