-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathre_python_example.py
More file actions
executable file
·26 lines (22 loc) · 936 Bytes
/
Copy pathre_python_example.py
File metadata and controls
executable file
·26 lines (22 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/python
import Renascence
def main():
Renascence.setStreamPath("./")
Renascence.setLibPath("./")
producer = Renascence.init(["func.xml"])
print producer.listAllFunctions()
print producer.listAllTypes()
x0 = producer.load('TrBmp', "input.jpg")
x1 = producer.load('TrBmp', "input_sharp.jpg")
x2 = producer.load('TrBmp', "output.jpg")
filterMatrix = producer.build("FR(x0, x1)").run(producer.merge(x2, x1))
print filterMatrix.dump()
[Trainner, BestValue] = producer.train("S(ADF(Treator,x0,x1))", producer.merge(x0, x1), 5, cacheFile='temp.txt', postFormula='FIT(x0, x1)', postExtraInput=x2)
formula = Trainner.ADF("")
print 'Formula: ', formula
print 'Parameters: ', Trainner.parameters()
print BestValue
predictor = producer.build(formula, Trainner.parameters())
y_p = predictor.run(producer.merge(x0,x1))
y_p.save("output/output_trained.jpg")
main()