def features(i): logger.info('Image:' +i['imageFile'] + ' modified %s ' % time.ctime(i['imageLastTouched'])) logger.info('Image:' +i['dataFile'] + ' Exists: '+ str(i['dataFileExists']) + ' Modified %s ' % time.ctime(i['dataLastTouched'])) logger.info('Requires Update: '+str(i['dataFileRequiresUpdate'])) try: Helpers.removeMatlabFeatureOutputFile() logger.info('Running '+ matLabFeatureScr) out,err,retCd = SysCall.sh([matLabFeatureScr, '"'+i['imageFile']+'"', 'false']) #out,err,retCd = SysCall.sh([matLabFeatureScr, Helpers.getTestImageName(), 'false']) logger.info('ret code:' +str(retCd)) logger.info('Script returned: ' + str( out)) if Helpers.checkFileNameExists(Helpers.getMatlabFeatureOutputFile()): return SerializeImageFeatures.ToDict(Helpers.getMatlabFeatureOutputFile()) else: return {} except: logger.exception('Error Updating Features For '+i['imageFile']) raise
def semanticElements(i): try: Helpers.removeMatlabSemanticElementsOutputFile() logger.info('Running '+ matLabSemanticElementsScr) out,err,retCd = SysCall.sh([matLabSemanticElementsScr, '"'+i['lcImageName']+'"']) #out,err,retCd = SysCall.sh([matLabFeatureScr, Helpers.getTestImageName(), 'false']) logger.info('ret code:' +str(retCd)) logger.info('Script returned: ' + str( out)) if Helpers.checkFileNameExists(Helpers.getMatlabFeatureOutputFile()): return SerializeSemanticElements.ToDict(Helpers.getMatlabSemanticElementsOutputFile()) else: return {} except: logger.exception('Error Updating Features For '+i['imageFile']) raise
1 break logger.info('Needs Update: '+i['imageFile']) try: Helpers.removeMatlabFeatureOutputFile() logger.info('Running '+ matLabFeatureScr) out,err,retCd = SysCall.sh([matLabFeatureScr, '"'+i['imageFile']+'"', 'false']) #out,err,retCd = SysCall.sh([matLabFeatureScr, Helpers.getTestImageName(), 'false']) logger.info('ret code:' +str(retCd)) logger.info('Script returned: ' + str( out)) if retCd <> 0: logger.error('Script Returned Error'+ err) logger.error('Stdout from script' + out) continue jsonString=MatlabOutputToJson.Get(Helpers.getMatlabFeatureOutputFile()) logger.info('Writing data to ' + i['dataFile']) f = open(i['dataFile'],'w') f.write(jsonString) f.close() updateCount+=1 except: logger.exception('Error Updating Features For '+i['imageFile']) errorCount+=1 logger.info('Feature Update Ran # of images: ' + str(updateCount)) if errorCount > 0: logger.error('Feature Update Errored out for # of images: ' + str(errorCount))