| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| |
|
| | #include <iostream>
|
| | #include <vector>
|
| | #include <string>
|
| | #include "../src/optical_model.hpp"
|
| | #include "../src/fungi.hpp"
|
| |
|
| |
|
| | const std::vector<std::string> CLASS_NAMES = {
|
| | "T-shirt/top", "Trouser", "Pullover", "Dress", "Coat",
|
| | "Sandal", "Shirt", "Sneaker", "Bag", "Ankle boot"
|
| | };
|
| |
|
| | int main() {
|
| | std::cout << "Fashion-MNIST Optical Evolution - Inference Example\n";
|
| | std::cout << "==================================================\n";
|
| | std::cout << "Enhanced FFT Kernel with 85.86% Accuracy\n\n";
|
| |
|
| | try {
|
| |
|
| | OpticalParams params;
|
| | DeviceBuffers db;
|
| | FFTPlan fft;
|
| | FungiSoA fungi;
|
| |
|
| |
|
| | std::cout << "Loading pre-trained model...\n";
|
| |
|
| | init_params(params, 42);
|
| |
|
| |
|
| | allocate_device_buffers(db, 1);
|
| | create_fft_plan(fft, 1);
|
| | fungi.resize(128, 28, 28);
|
| | fungi.init_random(42);
|
| |
|
| |
|
| | upload_params_to_gpu(params, db);
|
| |
|
| |
|
| | std::vector<float> input_image(IMG_SIZE);
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | for (int i = 0; i < IMG_SIZE; i++) {
|
| | input_image[i] = 0.5f;
|
| | }
|
| |
|
| | std::cout << "Processing image through optical network...\n";
|
| |
|
| |
|
| | std::vector<int> predictions;
|
| | infer_batch(input_image.data(), 1, fungi, params, db, fft, predictions);
|
| |
|
| |
|
| | int predicted_class = predictions[0];
|
| | std::cout << "\nPrediction Results:\n";
|
| | std::cout << "==================\n";
|
| | std::cout << "Predicted Class: " << predicted_class << "\n";
|
| | std::cout << "Class Name: " << CLASS_NAMES[predicted_class] << "\n";
|
| |
|
| | std::cout << "\nOptical Processing Details:\n";
|
| | std::cout << "- Multi-Scale FFT: 6-scale mirror architecture\n";
|
| | std::cout << "- Features Extracted: 2058 (Enhanced FFT)\n";
|
| | std::cout << "- Hidden Neurons: 1800\n";
|
| | std::cout << "- Fungi Population: 128 organisms\n";
|
| | std::cout << "- Technology: 100% Optical + CUDA\n";
|
| |
|
| |
|
| | free_device_buffers(db);
|
| | destroy_fft_plan(fft);
|
| |
|
| | std::cout << "\nInference completed successfully!\n";
|
| |
|
| | } catch (const std::exception& e) {
|
| | std::cerr << "Error during inference: " << e.what() << std::endl;
|
| | return 1;
|
| | }
|
| |
|
| | return 0;
|
| | }
|
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |