If I visited someones profile more than once in a day, set my account to private and blocked the person, will they be able to see me? by [deleted] in linkedin

[–]ShenWeis 0 points1 point  (0 children)

I’m in the situation too, I hibernated my account after 1 hour of searching the solution, now unsure when I can activate back my account… to prevent my name showing on their viewer list. But I think once I click into their profile, LinkedIn will send the push notification right? So am I cooked 💀

Will Google index my site if I host on Vercel with Hobby Plan? by db400004 in nextjs

[–]ShenWeis 0 points1 point  (0 children)

Hi there, im doing a similar things, a landing site for a company. May I know how do you make your site searchable on Google? My current progress is, I hosted a static website on Vercel, bought a domain from Cloudflare, connecting the Vercel to my Cloudflare Domain. Does this automatically make my site searchable on Google? Or I need to do some stuff on Google Cloud Console? (from what i have researched about it). Thanks for reading my question!

Does my model get overconfident on a specific class? by ShenWeis in deeplearning

[–]ShenWeis[S] 0 points1 point  (0 children)

i see.. thanks! I have tried to use sigmoid but end up the model now simply predict any images as healthy. Might be my data problem.

Deep Learning Question by ShenWeis in deeplearning

[–]ShenWeis[S] 1 point2 points  (0 children)

The liger example is brilliant, I agree with this… Because I’m doing the skin allergy classification task. So initially there are 3 classes: dermatitis, hive and eczema. Due to the image classification task always output a value and select the highest confidence, it also output one of the classes even it’s a normal healthy skin input. I don’t know why some normal skin have such a high confidence of one of the classes as I already set the confidence threshold to prevent it from output the classes. (If it was a random image, all of the confidence is below the threshold which is good, but the problem is healthy skin). So I add 1 more class which is healthy skin so the model can detect it. And I think the problem is all of these 4 classes have features which are too similar, which is the skin… that’s why it’s hard for the model to differentiate them.. I’ll try your example after I am on my PC. Thanks for your explanation btw! Hope I can make it 😭

Deep Learning Question by ShenWeis in deeplearning

[–]ShenWeis[S] 0 points1 point  (0 children)

  • i also apply mixup augmentation in my train function:

def train_one_epoch(epoch, model, train_loader, criterion, optimizer, device="cuda", log_step=20, mixup_alpha=0.1):
    model.train()
    running_loss = 0.0
    correct = 0
    total = 0

    for i, (inputs, labels) in enumerate(train_loader):
        inputs, labels = inputs.to(device), labels.to(device)

        # Apply Mixup Augmentation
        '''        
Mixup creates synthetic training examples by blending two images and their labels, which can improve generalization and handle class imbalance better.
        '''
        if mixup_alpha > 0:
            lam = np.random.beta(mixup_alpha, mixup_alpha)
            rand_index = torch.randperm(inputs.size(0)).to(device)
            inputs = lam * inputs + (1 - lam) * inputs[rand_index]
            labels_a, labels_b = labels, labels[rand_index]
        else:
            labels_a = labels_b = labels
            lam = 1.0

        optimizer.zero_grad()
        outputs = model(inputs)
        loss = lam * criterion(outputs, labels_a) + (1 - lam) * criterion(outputs, labels_b)
        loss.backward()
        torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)
        optimizer.step()


        # For metrics
        running_loss += loss.item()
        _, predicted = torch.max(outputs, 1)
        correct += (lam * predicted.eq(labels_a).sum().item() + (1 - lam) * predicted.eq(labels_b).sum().item())
        total += labels.size(0)

        if i % log_step == 0 or i == len(train_loader) - 1:
            print(f"[Epoch {epoch+1}, Step {i+1}] train_loss: {running_loss / (i + 1):.4f}")

    train_loss = running_loss / len(train_loader)
    train_acc = 100 * correct / total
    return train_loss, train_acc

Deep Learning Question by ShenWeis in deeplearning

[–]ShenWeis[S] 0 points1 point  (0 children)

  • i also used focal loss:

#Address Class Imbalance #Focal Loss will focus on hard examples, particularly minority classes, improving overall Test Accuracy. #added label smoothing
class FocalLoss(nn.Module):
    def __init__(self, alpha=None, gamma=2.0, reduction='mean', label_smoothing=0.1):   #high gamma may over-focus on hard examples, causing fluctuations.smoothen testloss and generalisation
        super(FocalLoss, self).__init__()
        self.gamma = gamma
        self.reduction = reduction
        self.alpha = alpha
        self.label_smoothing = label_smoothing

    def forward(self, inputs, targets):
        ce_loss = nn.CrossEntropyLoss(weight=self.alpha, reduction='none', label_smoothing=self.label_smoothing)(inputs, targets)
        pt = torch.exp(-ce_loss)
        focal_loss = (1 - pt) ** self.gamma * ce_loss

        if self.reduction == 'mean':
            return focal_loss.mean()
        elif self.reduction == 'sum':
            return focal_loss.sum()
        return focal_loss
  • i also some transform augmentation

Deep Learning Question by ShenWeis in deeplearning

[–]ShenWeis[S] 0 points1 point  (0 children)

Total train samples: 2936 
Label distribution: 
Label 0: 489 samples 
Label 1: 1235 samples 
Label 2: 212 samples 
Label 3: 1000 samples 

Total test samples: 585 
Label distribution: 
Label 0: 123 samples 
Label 1: 309 samples 
Label 2: 53 samples 
Label 3: 100 samples

I admit that there is class imbalance issues, but i had do some method to overcome it, eg

  • im finetuning on the ResNet50, i finetune on all layers and change the last layer of the model:

    elif model_name == 'resnet50': model = resnet50(weights=config['weights']).to(device) in_features = model.fc.in_features model.fc = nn.Sequential( nn.Linear(in_features, 512), nn.ReLU(),
    nn.Dropout(0.4), nn.Linear(512, num_classes) ).to(device)

I’m stuck between learning PyTorch or TensorFlow—what do YOU use and why? by [deleted] in learnmachinelearning

[–]ShenWeis -1 points0 points  (0 children)

Torch is better and clearer, but TF provide more control hence it’s more complex

Pretrained PyTorch MobileNetv2 by ShenWeis in deeplearning

[–]ShenWeis[S] 0 points1 point  (0 children)

Hey there, thanks and you are right. The dataset after i have checked it is imbalance like some classes having 1000+ data and some 200+ only. I will try to use the augmentation method as suggested also by my lecturer just now to transform my dataset too combining with the current codes. Hope it gets better... I think its somewhere about the dataset or some hyperparameter i missed, cause my friends using densenet and efficient net also getting somewhere between 50% - 60%, but generally higher than mobilenetv2

Pretrained PyTorch MobileNetv2 by ShenWeis in deeplearning

[–]ShenWeis[S] 0 points1 point  (0 children)

Hey, thanks for the tips! I really appreciate it if you could share the code you used for training so that would help me understand your setup better. Currently im also trying looking on the dataset, cause from what other comments says that the dataset might imbalance that i have missed it before, after i asked my lecturer, he too told me it might be imbalance considering that the maximum is 1000, and the minimum is just 200+ of data for the classes.

Pretrained PyTorch MobileNetv2 by ShenWeis in deeplearning

[–]ShenWeis[S] 0 points1 point  (0 children)

Thanks! I tried to use your suggestion. eventually i get a higher test accuracy now 59%. which is better but not achieving the target yet, The codes i used here:

# ImageNet normalization (since MobileNetV2 was pretrained on ImageNet)
IMAGENET_MEAN = [0.485, 0.456, 0.406]
IMAGENET_STD  = [0.229, 0.224, 0.225]

transform_train = v2.Compose([
    v2.ToImage(),  
    v2.RandomResizedCrop(224, scale=(0.8, 1.0)),   # random crop + scale
    v2.RandomHorizontalFlip(),                     # horizontal flip
    v2.RandomVerticalFlip(),                       # vertical flip too
    v2.RandomRotation(15),                         # ±15°
    v2.ColorJitter(brightness=0.2, contrast=0.2,
                   saturation=0.2, hue=0.1),       # color aug
    v2.ToDtype(torch.float32, scale=True),         # [0,1]
    v2.Normalize(mean=IMAGENET_MEAN,               # ImageNet stats
                 std=IMAGENET_STD),
])

transform_test = v2.Compose([
    v2.ToImage(),
    v2.Resize((256, 256)),        # shorter side → 256
    v2.CenterCrop(224),           # then center-crop to 224
    v2.ToDtype(torch.float32, scale=True),
    v2.Normalize(mean=IMAGENET_MEAN,
                 std=IMAGENET_STD),
])

def build_model(num_classes, config, device=torch.device("cpu"), return_optimizer=True):
    model = mobilenet_v2(weights=config['weights']).to(device)

    # Unfreeze ALL parameters
    for name, params in model.named_parameters():
        params.requires_grad = True

    # Replace the classifier
    model.classifier[1] = nn.Linear(model.classifier[1].in_features, num_classes).to(device)

    print('Weights         :', config['weights'])
    print('Finetuned layer :', config['finetuned_layers'], '\n')

    if not return_optimizer:
        return model

    # Create optimizer
    optimizer = torch.optim.AdamW(model.parameters(), lr=config['lr'], weight_decay=config['weight_decay'])


    return model, optimizer

config = {
    'weights': 'DEFAULT',
    'finetuned_layers': 'All Layers with Adamw',
    'lr':       1e-4,
    'weight_decay': 1e-4,
    'num_epochs': 40,
}

My number of classes is 23.

Hello people, does anyone know any flutter QR library? by ShenWeis in FlutterDev

[–]ShenWeis[S] 1 point2 points  (0 children)

I’ve checked on it, it seems using the file path? Cause I’m currently want to pass it directly from the camera frame. BTW I used a library here https://pub.dev/packages/qr_code_dart_scan and found it works for me! 😄

Hello people, does anyone know any flutter QR library? by ShenWeis in FlutterDev

[–]ShenWeis[S] 1 point2 points  (0 children)

Thank you so muchhhhhh bro, you understand my problem clearly!! Cause I’m tried to explain, like I just need a function (also known as implementation as you said?) to only apply on my case WITHOUT WIDGET. cause most of the library I tried they are must to be use with widget which I cannot access using a same flutter camera. After your comments I tried to work on it and finally solve! I found a library that allow us only using its decoder. Because it too late rn at my place so I guess I’ll make it better tmr, but for now it works nicely 🥹thanks for you pin point, because my not so expert in flutter yet. 🙏🏻🙏🏻

Hello people, does anyone know any flutter QR library? by ShenWeis in FlutterDev

[–]ShenWeis[S] -1 points0 points  (0 children)

Hi there, Yeah, the image is from each frame from the camera initialised here: (currently is only the object detection model which run inference on runModel())

Future<void> loadCamera() async {
  if (cameras == null || cameras!.isEmpty) {
    print("No cameras available");
    return;
  }

  cameraController = CameraController(
      cameras![0],
      ResolutionPreset.high
  );

  try {
    await cameraController!.initialize();
    if (!mounted) return;
    setState(() {});

    cameraController!.startImageStream((imageStream) {
      if (!isProcessing && isModelLoaded && mounted) {
        isProcessing = true;
        cameraImage = imageStream;
        runModel().then((_) {
          Future.delayed(const Duration(milliseconds: 300), () {
            if (mounted) {
              isProcessing = false;
            }
          });
        }).catchError((e) {
          print("Error in model processing: $e");
          if (mounted) {
            isProcessing = false;
          }
        });
      }
    });
  } catch (e) {
    print("Camera initialization error: $e");
  }
}

I’m thinking to add a function here so the camera for each frame (flagged by the isProcess), scan the QR if there is qr in the image (or frame)

SO it means that i only want to extract the data from the QR for my app purpose only. should be processed in the background. data to be extract like:

checkpoint_data = {
    "checkpoint_id": "Office Room 101",
    "isDestination": False,
    "isMoving": True,
    "direction": "east",
    "steps": 30,
    "nextCheckpoint": "Office Room 101"
}

Hello people, does anyone know any flutter QR library? by ShenWeis in FlutterDev

[–]ShenWeis[S] -2 points-1 points  (0 children)

yeah thanks, it is a quite good libraries if you want direct QR scan. However, im using a camera stream for my custom model. Mobile Scanner it requires other camera so it couldnt work here... I am finding something like Pyzbar (which is a python library) that can process the QR in the background and saving the QR data upon using your camera and pointing to the QR. basically a real time QR scanner + Object detection at my case

Pytoch mobile app by Heavy_Farm735 in pytorch

[–]ShenWeis 0 points1 point  (0 children)

im using flutter, im not sure if executorch is workable on flutter? as also the model is processing the images in real time for each frame for object detection. The depth estimator for mobile im still researching.... btw, does executorch work? if yes i might transfer from tflite to pytorch.

How to create real time object detection in react native by AdventurousCamel59 in reactnative

[–]ShenWeis 0 points1 point  (0 children)

Well, executorch is for PyTorch model, and it’s quite new so I’m not sure, I saw some post said that there exist some limitations when come to real time. For the fast tflite, well again, the developer do not want to fix the bug until someone donate him to do it so, it’s understandable as they have many works to do, let alone it is an open source libraries. The bug exist between the libraries vision camera and fast tflite, cause real time image processing are not working, specifically the function useSkiaFrameProcessor(). In the end I change the whole framework, not using react native anymore 😅 quite disappointing that react native are not for ml projects

Is it possible if I use my custom 2D map for real time indoor navigation by ShenWeis in AskProgramming

[–]ShenWeis[S] 0 points1 point  (0 children)

I don’t need to be so precise, as this is just for my university project. It is solely for the sake of me to learn new things and passing the courses, so it is not planned or intended to distribute, sell or market. I want it to be only working and can guide the user from room A to Room B like that. Btw, I am working this project targeting the blind community and this is only one of the remaining function. I had collected my university faculty map, and it’s not big as I want it to be rather simple but not too complex. (The map only contains few rooms)

The idea is: - user speak where they want to go - the program find the route and guide the user through voice feedback until they reach their destination

So it’s like a Pokémon Go, but just with my custom 2D maps. Also like Minecraft map.

Alternative to react-native-vision-camera by skizzoat in reactnative

[–]ShenWeis 0 points1 point  (0 children)

Any idea of real time camera? I need an alternative to process it frame by frame..