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
var tree = SyntaxFactory.ParseSyntaxTree(@" | |
using System; | |
namespace NS1 | |
{ | |
public class C | |
{ | |
int InstanceField = 0; | |
internal void InstanceMethod() | |
{ | |
Console.WriteLine(InstanceField); |
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
public class EmtpyStatementRemoval : CSharpSyntaxRewriter | |
{ | |
public override SyntaxNode VisitEmptyStatement(EmptyStatementSyntax node) | |
{ | |
//Simply remove all Empty Statements | |
return null; | |
} | |
} | |
public static void Main(string[] args) |
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
using Microsoft.CodeAnalysis.CSharp; | |
using Microsoft.CodeAnalysis.CSharp.Syntax; | |
var tree = CSharpSyntaxTree.ParseText(@" | |
public class MyClass | |
{ | |
public void MyMethod() | |
{ | |
} | |
}"); |
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
// Place your key bindings in this file to override the defaults | |
[ | |
{ | |
"key": "ctrl+k ctrl+o", | |
"command": "workbench.action.files.openFolder" | |
}, | |
{ | |
"key": "ctrl+o", | |
"command": "workbench.action.files.openFile" | |
}, |
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
learner = load_learner('../data/cropped_faces','effnet_test.pkl', | |
test=ImageList.from_folder('/home/josh/git/kgl_deepfake/data/cropped_faces/valid')) | |
# Opening an image with fastai | |
fastai_img = open_image('/home/josh/git/kgl_deepfake/data/cropped_faces/valid/vylzsyazmx.mp4_1_REAL.jpg') | |
print(fastai_img.shape) | |
# Opening an image manually | |
manual_img = PILImage.open('/home/josh/git/kgl_deepfake/data/cropped_faces/valid/vylzsyazmx.mp4_1_REAL.jpg') | |
manual_img_array = np.array(manual_img, dtype=np.float32) / 255. |
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
var tree = CSharpSyntaxTree.ParseText(@" | |
class MyClass | |
{ | |
int myField = 0; | |
public int MyProperty {get; set;} | |
public void MyMethod() { } | |
}"); | |
var Mscorlib = PortableExecutableReference.CreateFromAssembly(typeof(object).Assembly); | |
var compilation = CSharpCompilation.Create("MyCompilation", |
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
def get_img_pil(path): | |
img = Image.open(path) | |
arr = np.asarray(img) | |
img.close() | |
del img | |
return arr | |
def get_img_cv2(path): | |
img = cv2.imread(path) |
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
learn.fit_one_cycle(10, max_lr=(1e-2)) |
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
learn.fit_one_cycle(10, max_lr=(1e-2)) |
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
learn = cnn_learner(data, models.resnet18, pretrained=False, metrics=[f_score]) | |
learn.unfreeze() | |
learn.fit_one_cycle(10, max_lr=slice(1e-6,1e-2)) |
NewerOlder