Skip to content

Instantly share code, notes, and snippets.

@Tahsin-Mayeesha
Tahsin-Mayeesha / invisibility.py
Created August 10, 2020 16:55
Code gathered from multiple tutorials
import cv2
import numpy as np
import time
cap = cv2.VideoCapture(0)
time.sleep(1)
background = 0
for i in range(30):
ret, background = cap.read()
"""Official evaluation script for SQuAD version 2.0.
In addition to basic functionality, we also compute additional statistics and
plot precision-recall curves if an additional na_prob.json file is provided.
This file is expected to map question ID's to the model's predicted probability
that a question is unanswerable.
"""
import argparse
import collections
import json
class LanguageClassifier(tf.train.Checkpoint):
def __init__(self,language_module,num_labels,dense_units=(128,128),dropouts=(0.1,0.1)):
# initialization stuff
super(LanguageClassifier,self).__init__()
self.language_module = language_module
self.model_encoder = language_module.model
# classifier head layers
---------------------------------------------------------------------------
InvalidArgumentError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py in get_attr(self, name)
2325 with c_api_util.tf_buffer() as buf:
-> 2326 c_api.TF_OperationGetAttrValueProto(self._c_op, name, buf)
2327 data = c_api.TF_GetBuffer(buf)
InvalidArgumentError: Operation 'StatefulPartitionedCall' has no attr named '_XlaCompile'.
During handling of the above exception, another exception occurred:

Tahsin Mayeesha is currently working with Berkman Klein Center Of Internet and Society on interactive network visualization project as a participant of Google Summer Of Code 2018. Previously, she worked in Cramstack on electricity data, a data science startup in Bangladesh focusing on consulting and government project. Currently she's an undergraduate student in North South University, Bangladesh majoring in computer science. She runs "Learning Machine Learning" publication in Medium featuring tutorials and projects. Mayeesha graduated from Udacity's Machine Learning Nanodegree in 2017 and also participated in Fast.ai as an international fellow.

import math
import networkx as nx
from itertools import combinations
from utils import set_node_size
from fa2l import force_atlas2_layout
def get_distance(pos1,pos2):
""" Returns distance between two points
def set_node_color(G,color_by,colormap=None):
"""
Returns a list of colors for each node based on the provided colormap.
Parameters
___________
G : graph.
A networkx graph.
# this has to be first to make sure that matplotlib runs in headless mode
import matplotlib
matplotlib.use("Agg")
import sys
import numpy as np
import warnings
warnings.filterwarnings('ignore')
from fa2l import force_atlas2_layout
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.