Skip to content

Instantly share code, notes, and snippets.

View fernandocamargoai's full-sized avatar

Fernando Camargo fernandocamargoai

View GitHub Profile
@fernandocamargoai
fernandocamargoai / queue-processor.js
Created December 20, 2022 23:38
DataDog Issue (2)
'use strict'
// Must come before importing any instrumented module.
import tracer from 'dd-trace';
tracer.init();
import { PubSub } from '@google-cloud/pubsub'
import { Storage } from "@google-cloud/storage"
import { status as gRPCStatus } from '@grpc/grpc-js'
@fernandocamargoai
fernandocamargoai / queue-processor.js
Last active December 20, 2022 19:43
DataDog Issue (2)
'use strict'
// Must come before importing any instrumented module.
import tracer from 'dd-trace';
tracer.init();
import { PubSub } from '@google-cloud/pubsub'
import { Storage } from "@google-cloud/storage"
import { status as gRPCStatus } from '@grpc/grpc-js'
@fernandocamargoai
fernandocamargoai / queue-processor.js
Last active December 16, 2022 17:38
DataDog issue
'use strict'
// Must come before importing any instrumented module.
import tracer from 'dd-trace';
tracer.init();
import { PubSub } from '@google-cloud/pubsub'
import { Storage } from "@google-cloud/storage"
import { status as gRPCStatus } from '@grpc/grpc-js'
@fernandocamargoai
fernandocamargoai / data.py
Last active March 16, 2021 04:57
Simple ImageDataLoader with tf.data and imgaug
import os
from typing import Callable, Tuple
import numpy as np
import pandas as pd
import tensorflow as tf
from imgaug import augmenters as iaa
def rescale(images: tf.Tensor) -> tf.Tensor:
@fernandocamargoai
fernandocamargoai / dataset.py
Created May 30, 2020 12:25
Custom JsonDataset
import functools
import os
import warnings
from glob import glob
from multiprocessing import Pool
from pathlib import Path
from typing import Optional, Iterator, List
import numpy as np
import ujson as json
import json
from typing import NamedTuple, Tuple
import PIL.Image
import numpy as np
from bentoml import BentoService, api, env, ver, artifacts
from bentoml.artifact import KerasModelArtifact, TextFileArtifact, TensorflowSavedModelArtifact
from bentoml.handlers import ImageHandler
import tensorflow as tf
from tensorflow.keras import Model
@fernandocamargoai
fernandocamargoai / aug.py
Created April 29, 2020 12:43
Conditional Augmenter
import imgaug.augmenters as iaa
import numpy as np
class Conditional(iaa.Augmenter):
"""Apply child augmenter(s) for images wich a given conditional comes true.
Let ``C`` be one or more child augmenters given to
:class:`~imgaug.augmenters.meta.Conditional`.
Let ``p`` be the fraction of images (or other data) to augment.
INFO: [pid 14484] Worker Worker(salt=140992192, workers=1, host=ufgdeepfood.RadSquare.cloud, username=fernando, pid=14484) running EvaluateIfoodModel(model_module=recommendation.task.model.m
atrix_factorization, model_cls=MatrixFactorizationTraining, model_task_id=MatrixFactorizationTraining____500_False_4bb5a61c77, limit_list_size=50, nofilter_iteractions_test=False, task_hash=no
ne, num_processes=16, bandit_policy=none, bandit_policy_params={}, bandit_weights=none, batch_size=100000, plot_histogram=False, no_offpolicy_eval=False)
2020-01-23 13:36:38,335 : INFO : [pid 14484] Worker Worker(salt=140992192, workers=1, host=ufgdeepfood.RadSquare.cloud, username=fernando, pid=14484) running EvaluateIfoodModel(model_module=
recommendation.task.model.matrix_factorization, model_cls=MatrixFactorizationTraining, model_task_id=MatrixFactorizationTraining____500_False_4bb5a61c77, limit_list_size=50, nofilter_iteractio
ns_test=False, task_hash=none, num_processes=16, bandit_policy=none, bandit_policy_params={}, band
@fernandocamargoai
fernandocamargoai / multilayer_perceptron.py
Created April 13, 2018 00:19
Rede Neural implementada com numpy
import numpy as np
from typing import List, Callable, Tuple
import math
def shuffle(a: np.ndarray, b: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
assert len(a) == len(b)
p = np.random.permutation(len(a))
return a[p], b[p]
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.0.final using JasperReports Library version 6.3.0 -->
<!-- 2016-11-24T10:44:25 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="danfe_nfce_80" pageWidth="226" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="214" leftMargin="2" rightMargin="10" topMargin="2" bottomMargin="2" uuid="5ce393bf-1e81-4d5c-8158-54fb1fa7db75">
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="mm"/>
<property name="com.jaspersoft.studio.data.sql.tables" value="ZmlsaWFsIEFTICw2OCwyLGI4NDNiMGE4LTgzOTEtNDU1MC05YzZkLTEzMmZjZDkxYTE0OTs="/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio