00001 /*!@file CUDA/CudaHmaxCBCL.H Wrapper class for CBCL CUDA model */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00005 // University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: Daniel Parks <danielfp@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/CUDA/CudaHmaxCBCL.H $ 00035 // $Id: CudaHmaxCBCL.H 14154 2010-10-21 05:07:25Z dparks $ 00036 // 00037 00038 #ifndef CUDAHMAXCBCL_H_DEFINED 00039 #define CUDAHMAXCBCL_H_DEFINED 00040 00041 #include "cbcl_model.h" 00042 #include "Image/Image.H" 00043 00044 class CudaHmaxCBCL 00045 { 00046 public: 00047 CudaHmaxCBCL(); 00048 CudaHmaxCBCL(std::string c0patchFile, std::string c1patchFile); 00049 ~CudaHmaxCBCL(); 00050 void loadC0(std::string c0patchFile); 00051 void loadC1(std::string c1patchFile); 00052 std::vector<std::string> readList(std::string inName); 00053 std::vector<std::string> readDir(std::string inName); 00054 void extractC1Patch(Image<float> &stim, int index, int patchSize); 00055 void initC1Patches(int numPatches, int patchSize, int patchDepth); 00056 void extractC1Patches(std::vector<std::string> files, int numPatches, int patchSize, int patchDepth); 00057 void writeOutFeatures(std::string c2FileName, int id, bool clearFile=false); 00058 void writeOutC1Patches(std::string filename); 00059 void readFilters(std::string filename,band_info** ppfilt,int* pnfilts); 00060 void writeFilters(band_info* pfilt,int nfilts, std::string filename); 00061 void extractPatches(std::vector<std::string> files, int numPatches); 00062 float *getC2Features(); 00063 int numC2Features(); 00064 void getC1(const float *pimg, int width, int height, bool copy=true); 00065 void getC2(const float *pimg, int width, int height); 00066 void clearC1(); 00067 void clearC2(); 00068 private: 00069 band_info *c0; 00070 band_info *s1; 00071 band_info* c1; 00072 band_info* s2; 00073 float* c2b; 00074 00075 band_info *c0patches; 00076 band_info *c1patches; 00077 int nc0patches; 00078 int nc1patches; 00079 int nc0bands; 00080 int ns1bands; 00081 int nc1bands; 00082 int ns2bands; 00083 int nc2units; 00084 }; 00085 00086 #endif