View frtizStyleModel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { RNFritzVisionImageStyling } from 'react-native-fritz'; | |
const poppyField = await RNFritzVisionImageStyling({ | |
name: 'poppyField', | |
customModel: false, | |
}); |
View fritz.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RNFritz from 'react-native-fritz'; | |
RNFritz.configure(); |
View frtizStyleModel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { RNFritzVisionImageStyling } from 'react-native-fritz'; | |
const darkKnights = await RNFritzVisionImageStyling({ | |
name: 'darkKnights', | |
modelIdentifier: '55cdc02f89174e1c8458690d5b8621ae', // Your model identifier here | |
customModel: true, | |
modelVersion: 1, | |
}); |
View Podflie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uncomment the next line to define a global platform for your project | |
platform :ios, '11.0' | |
target 'MyStylingApp' do | |
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks | |
# use_frameworks! | |
# Linking React Native for Pods Projects | |
rn_path = '../node_modules/react-native' | |
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec" |
View selectImage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ImagePicker from 'react-native-image-picker'; | |
/* More info on all the options | |
* | |
* https://github.com/react-native-community/react-native-image-picker/blob/master/docs/Reference.md#options | |
* | |
*/ | |
const options = { | |
title: 'Select Image for styling', | |
storageOptions: { |
View imagenet.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash'; | |
import { imagenetClasses } from '../data/imagenet'; | |
/** | |
* Find top k imagenet classes | |
*/ | |
export function imagenetClassesTopK(classProbabilities: any, k = 5) { | |
const probs = _.isTypedArray(classProbabilities) ? | |
Array.prototype.slice.call(classProbabilities) : classProbabilities; |
View runModel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function runModel(model: InferenceSession, preProcessedData: Tensor): Promise<[Tensor, number]> { | |
const start = new Date(); | |
try { | |
const outputData = await model.run([preProcessedData]); | |
const end = new Date(); | |
const inferenceTime = (end.getTime() - start.getTime()); | |
const output = outputData.values().next().value; | |
return [output, inferenceTime]; | |
} catch (e) { | |
console.error(e); |
View loadImageToCanvas.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import loadImage from 'blueimp-load-image'; | |
const imageLoaderConfigs = { | |
maxWidth: 224, | |
maxHeight: 224, | |
cover: true, | |
crop: true, | |
canvas: true, | |
crossOrigin: 'Anonymous', | |
} |
View processImage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* processImage | |
* | |
* Responsible for getting image from react native camera and | |
* starting image processing. | |
* | |
* @param {string} uri Path for the image to be processed | |
* @param {object} imageProperties Other properties of image to be processed | |
* @memberof App | |
* @author Zain Sajjad |
NewerOlder