Changeset 2011


Ignore:
Timestamp:
01/22/07 15:31:08 (17 years ago)
Author:
bittner
Message:

mutation strategy updated, importance depending on rsuccess

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp

    r2010 r2011  
    16131613                "false"); 
    16141614 
     1615         
    16151616        RegisterOption("ViewCells.useKdPvsAfterFiltering", 
    16161617                                   optBool,  
  • GTP/trunk/Lib/Vis/Preprocessing/src/Makefile

    r2008 r2011  
    11############################################################################# 
    22# Makefile for building: preprocessor 
    3 # Generated by qmake (2.00a) (Qt 4.1.2) on: ne 21. I 22:47:46 2007 
     3# Generated by qmake (2.00a) (Qt 4.1.2) on: po 22. I 08:54:12 2007 
    44# Project:  preprocessor.pro 
    55# Template: app 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.cpp

    r2006 r2011  
    2626 
    2727#define Q_SEARCH_STEPS 3 
     28 
     29#define SORT_RAY_ENTRIES 1 
     30 
     31// use avg ray contribution as importance 
     32// if 0 the importance is evaluated from the succ of mutations 
     33#define USE_AVG_CONTRIBUTION 1 
     34 
     35MutationBasedDistribution::RayEntry & 
     36MutationBasedDistribution::GetEntry(const int index) 
     37{ 
     38#if SORT_RAY_ENTRIES 
     39  return mRays[index]; 
     40#else 
     41  return mRays[(mBufferStart+index)%mRays.size()]; 
     42#endif 
     43} 
    2844 
    2945void 
     
    5773 
    5874  int reverseCandidates = 0; 
    59    
     75 
     76#if 0 
     77  sort(mRays.begin(), mRays.end()); 
     78  // reset the start of the buffer 
     79  mBufferStart = 0; 
     80#endif 
     81 
    6082  for (int i=0; i < vssRays.size(); i++) { 
    6183        if (vssRays[i]->mPvsContribution) { 
     
    92114                *mRays[mBufferStart].mRay = *vssRays[i]; 
    93115                mRays[mBufferStart].mMutations = 0; 
     116                mRays[mBufferStart].mUnsuccessfulMutations = 0; 
    94117                mRays[mBufferStart].ResetReverseMutation(); 
    95118                //              mRays[mBufferStart] = RayEntry(newRay); 
     
    97120                if (mBufferStart >= mMaxRays) 
    98121                  mBufferStart = 0; 
    99                  
    100  
    101122          } 
    102123        } else { 
     
    156177        cout<<"Reverse candidates:"<<reverseCandidates<<endl; 
    157178  } 
    158  
     179   
    159180  float pContributingRays = contributingRays/(float)vssRays.size(); 
     181   
     182  cout<<"Percentage of contributing rays:"<<pContributingRays<<endl; 
     183   
     184#if USE_AVG_CONTRIBUTION 
    160185  float importance = 1.0f/(pContributingRays + 1e-5); 
    161   // float importance = 1.0f; 
     186// float importance = 1.0f; 
    162187  // set this values for last contributingRays 
    163188  int index = mBufferStart - 1; 
     
    168193        mRays[index].mImportance = importance; 
    169194  } 
    170  
     195#else 
     196  // use unsucc mutation samples as feedback on importance 
     197  for (int i=0; i < mRays.size(); i++) { 
     198        const float  minImportance = 0.1f; 
     199        const int minImportanceSamples = 20; 
     200        mRays[i].mImportance = minImportance + 
     201          (1-minImportance)*exp(-3.0f*mRays[i].mUnsuccessfulMutations/minImportanceSamples); 
     202         
     203        //mRays[i].mImportance = 1.0f/(mRays[i].mUnsuccessfulMutations+3); 
     204        //      mRays[i].mImportance = 1.0f; 
     205  } 
     206#endif 
     207   
     208#if SORT_RAY_ENTRIES 
     209  long t1 = GetTime(); 
     210  sort(mRays.begin(), mRays.end()); 
     211  // reset the start of the buffer 
     212  mBufferStart = 0; 
     213  mLastIndex = mRays.size(); 
     214  cout<<"Mutation candidates sorted in "<<TimeDiff(t1, GetTime())<<" ms."<<endl; 
     215#endif 
     216   
    171217#if MUTATION_USE_CDF 
    172218  // compute cdf 
     
    184230        GetEntry(0).mImportance<<" "<< 
    185231        GetEntry(mRays.size()-1).mImportance<<endl; 
    186    
     232 
     233  cout<<"Sampling factor = "<< 
     234        GetEntry(0).GetSamplingFactor()<<" "<< 
     235        GetEntry(mRays.size()-1).GetSamplingFactor()<<endl; 
     236 
    187237  cerr<<"Mutation update done."<<endl; 
    188238} 
     
    516566 
    517567#if !MUTATION_USE_CDF 
     568#if SORT_RAY_ENTRIES 
     569  index = mLastIndex - 1; 
     570  if (index < 0 || index >= mRays.size()-1) { 
     571        index = mRays.size() - 1; 
     572  } else 
     573        if ( 
     574                mRays[index].GetSamplingFactor() >= mRays[mLastIndex].GetSamplingFactor()) { 
     575          // make another round 
     576 
     577          //      cout<<"R2"<<endl; 
     578          //      cout<<mLastIndex<<endl; 
     579          //      cout<<index<<endl; 
     580          index = mRays.size() - 1; 
     581        } 
     582#else 
    518583  // get tail of the buffer 
    519584  index = (mLastIndex+1)%mRays.size(); 
     
    534599        index = (index+1)%mRays.size(); 
    535600  } 
     601#endif 
    536602#else 
    537603  static HaltonSequence iHalton; 
     
    558624 
    559625  mLastIndex = index; 
    560  
     626  //  Debug<<index<<" "<<mRays[index].GetSamplingFactor()<<endl; 
     627   
    561628  if (mRays[index].HasReverseMutation()) { 
    562629        //cout<<"R "<<mRays[index].mutatedOrigin<<" "<<mRays[index].mutatedTermination<<endl; 
     
    768835 
    769836 
    770 } 
     837 
     838} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Mutation.h

    r2001 r2011  
    5757         
    5858        float GetSamplingFactor() const { return mMutations/mImportance; } 
     59         
     60        friend bool operator<(const RayEntry &a, const RayEntry &b) { 
     61          return a.GetSamplingFactor() > b.GetSamplingFactor(); 
     62        } 
     63         
    5964        RayEntry() {} 
    6065        RayEntry(VssRay *r):mRay(r), 
     
    118123                                                 ); 
    119124 
    120   RayEntry &GetEntry(const int index) { 
    121         return mRays[(mBufferStart+index)%mRays.size()]; 
    122   } 
     125  RayEntry &GetEntry(const int index); 
     126 
    123127   
    124128  vector<RayEntry> mRays; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2008 r2011  
    12031203#if 1 
    12041204  mRayCaster->SortRays(rays); 
    1205   cout<<"Rays sorted in "<<TimeDiff(t1, GetTime())<<" s."<<endl; 
     1205  cout<<"Rays sorted in "<<TimeDiff(t1, GetTime())<<" ms."<<endl; 
    12061206 
    12071207  if (0) { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/default.env

    r2008 r2011  
    6161#       type render 
    6262        detectEmptyViewSpace true 
    63 #       pvsRenderErrorSamples 0 
    64         pvsRenderErrorSamples 10000 
     63        pvsRenderErrorSamples 0 
     64#       pvsRenderErrorSamples 10000 
    6565        quitOnFinish false 
    6666        computeVisibility true 
     
    111111 
    112112        useImportanceSampling true 
    113  
    114113 
    115114        Export { 
  • GTP/trunk/Lib/Vis/Preprocessing/src/run_test2

    r2008 r2011  
    77#VIEWCELLS=../data/vienna/vienna-viewcells-5000.xml 
    88 
    9 #SCENE=../data/soda/soda5.dat 
     9 
     10#SCENE=../data/soda/soda.obj 
    1011#VIEWCELLS=../data/soda/soda5-viewcells-1000.xml 
    1112#VIEWCELLS=../data/soda/soda5-viewcells-single.xml 
     
    4950$COMMAND -preprocessor=combined -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 
    5051 -rss_distributions=mutation+object_direction+spatial -view_cells_filter_max_size=1 \ 
    51  -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4h.xml \ 
    52  -preprocessor_stats=$PREFIX-i-mixed-b1-n4h.log \ 
    53  -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4h.hlog 
     52 -view_cells_use_kd_pvs- -af_use_kd_pvs- \ 
     53 -preprocessor_visibility_file=$PREFIX-i-mixed-b1-n4i.xml \ 
     54 -preprocessor_stats=$PREFIX-i-mixed-b1-n4i.log \ 
     55 -preprocessor_histogram_file=$PREFIX-i-mixed-b1-n4i.hlog 
    5456 
    5557 
     
    5860# g - gaussian origin, q=2, reverse samples 
    5961 
     62# g, h contain pvs error estimations... 
    6063 
    6164# $COMMAND -scene_filename=$SCENE -view_cells_filename=$VIEWCELLS \ 
Note: See TracChangeset for help on using the changeset viewer.